Пример #1
0
        [Test][Assert_Admin] public void load_UserData()
        {
            admin.assert();

            var tmFileStorage = new TM_FileStorage(false);              // create empty TM_FileStorage
            var tmServer      = tmFileStorage.Server;
            var userData      = tmFileStorage.UserData;

            Assert.IsNotNull(tmServer);
            Assert.IsNotNull(userData);

            //tmServer.Users_Create_Default_Admin = true;

            tmFileStorage.load_UserData();

            Assert.IsEmpty(userData.TMUsers);

            none.assert();

            Assert.Ignore("Add checks specific to the load_UserData method ");
        }
Пример #2
0
        //workflows
        [Test] public void Check_Non_Git_Repo_Doesnt_Commit()
        {
            tmServer.assert_Not_Null().Git.UserData_Git_Enabled = false;
            var temp_Path_UserData = "nonGitRepo".tempDir();

            tmFileStorage.Path_UserData = temp_Path_UserData;

            tmFileStorage.path_UserData().assert_Folder_Exists()
            .assert_Folder_Empty()
            .assert_Is(temp_Path_UserData);

            admin.assert(() => tmFileStorage.load_UserData());

            tmFileStorage.users_XmlFile_Location().assert_Folder_Exists()        // before we create the default admin user (below)
            .assert_Folder_Empty();                                              // there should be no files in the userData's user's folder

            userData.tmUsers().assert_Empty();

            manageUsers.assert(() => userData.createDefaultAdminUser());

            tmFileStorage.users_XmlFile_Location().assert_Folder_Has_Files()     // now there should be files in the userData's user's folder
            .files().assert_Size_Is(1)
            .first().fileName().assert_Starts("admin");

            userData.tmUsers().assert_Size_Is(1);

            userData.tmUser("admin").assert_Not_Null();

            tmFileStorage.path_UserData().assert_False(path => path.isGitRepository())
            .files().assert_Not_Empty()
            .first().parentFolder().assert_Folder_File_Count_Is(1)
            .files(true).assert_Size_Is(2);

            Files.delete_Folder_Recursively(tmFileStorage.path_UserData())
            .assert_True("UserData Folder failed to delete");

            tmFileStorage.path_UserData().assert_Folder_Doesnt_Exist();

            tmServer.assert_Not_Null().Git.UserData_Git_Enabled = true;
        }