Example #1
0
 public static void assertIgnore_If_Offine(this TM_QA_Config qaConfig, Uri targetServer)
 {
     if (qaConfig.serverOffline())
     {
         Assert.Ignore("[TM_QA_Config] TM server is offline: {0}".info(targetServer));
     }
 }
Example #2
0
 public static TM_QA_Config     addDefaultTestUsers(this TM_QA_Config tmQaConfig)
 {
     tmQaConfig.new_UserList()
     .add_User("qa-admin", 1)
     .add_User("qa-reader", 2)
     .add_User("qa-editor", 3);
     return(tmQaConfig);
 }
Example #3
0
 public static TM_QA_Config                  save_QAConfig(this TM_QA_Config qaConfig)
 {
     if (qaConfig.notNull())
     {
         var localFilePath = new TM_QA_Config_Loader().localFilePath();
         qaConfig.saveAs(localFilePath);
     }
     return(qaConfig);
 }
Example #4
0
        [SetUp] public void setup()
        {
            qaConfigLoader = new TM_QA_Config_Loader();
            qaConfig       = new TM_QA_Config_Loader().load();

            Assert.IsNotNull(qaConfigLoader);
            Assert.IsNotNull(qaConfig);
            Assert.IsFalse(TM_QA_Config.Force_Server_Offline);
        }
Example #5
0
 public static bool                          serverOnline(this TM_QA_Config tmQaConfig, Uri targetServer)
 {
     if (targetServer.notNull())
     {
         if (TM_QA_Config.Force_Server_Offline)
         {
             return(false);
         }
         return(targetServer.append("default.htm")
                .HEAD());
     }
     return(false);
 }
Example #6
0
        [Test] public void load_create()
        {
            var tmpFolder = "TM_QA_Config".tempDir(false);
            var tmpFile   = 10.randomLetters().append(".txt");

            qaConfigLoader = new TM_QA_Config_Loader(tmpFolder, tmpFile);

            Assert.IsFalse(qaConfigLoader.localFilePath().fileExists());

            qaConfig = qaConfigLoader.create();

            //check values
            Assert.NotNull(qaConfig);
            Assert.IsTrue(qaConfig.Firebase_Site.valid());
            Assert.IsTrue(qaConfig.Firebase_Area.valid());
            Assert.IsTrue(qaConfig.SMTP_Server.valid());
            Assert.IsTrue(qaConfig.SMTP_UserName.valid());
            Assert.IsTrue(qaConfig.Default_Admin_Email.valid());
            Assert.IsTrue(qaConfig.Default_Admin_User.valid());
            Assert.IsTrue(qaConfig.Default_Admin_Pwd.valid());
            Assert.AreEqual(qaConfig.Firebase_AuthToken, "");
            Assert.AreEqual(qaConfig.SMTP_Password, "");
            Assert.NotNull(qaConfig.TestUsers);
            Assert.AreEqual(qaConfig.TestUsers.size(), 3);

            // check that is exists and it is also created using .load()
            var localFilePath = qaConfigLoader.localFilePath();

            Assert.IsTrue(localFilePath.fileExists());
            localFilePath.file_Delete();
            Assert.IsFalse(localFilePath.fileExists());
            Assert.IsNotNull(qaConfigLoader.load());
            Assert.IsTrue(localFilePath.fileExists());

            //delete temp folder
            Assert.IsTrue(tmpFolder.dirExists());
            Assert.IsTrue(Files.deleteFolder(tmpFolder, true));
            Assert.IsFalse(tmpFolder.dirExists());
        }
        public void load_create()
        {
            var tmpFolder = "TM_QA_Config".tempDir(false);
            var tmpFile = 10.randomLetters().append(".txt");

            qaConfigLoader = new TM_QA_Config_Loader(tmpFolder, tmpFile);

            Assert.IsFalse(qaConfigLoader.localFilePath().fileExists());

            qaConfig = qaConfigLoader.create();

            //check values
            Assert.NotNull (qaConfig                             );
            Assert.IsTrue  (qaConfig.Firebase_Site       .valid());
            Assert.IsTrue  (qaConfig.Firebase_Area       .valid());
            Assert.IsTrue  (qaConfig.SMTP_Server         .valid());
            Assert.IsTrue  (qaConfig.SMTP_UserName       .valid());
            Assert.IsTrue  (qaConfig.Default_Admin_Email .valid());
            Assert.IsTrue  (qaConfig.Default_Admin_User  .valid());
            Assert.IsTrue  (qaConfig.Default_Admin_Pwd   .valid());
            Assert.AreEqual(qaConfig.Firebase_AuthToken  , ""    );
            Assert.AreEqual(qaConfig.SMTP_Password       , ""    );
            Assert.NotNull (qaConfig.TestUsers                   );
            Assert.AreEqual(qaConfig.TestUsers.size()    , 3     );

            // check that is exists and it is also created using .load()
            var localFilePath = qaConfigLoader.localFilePath();
            Assert.IsTrue   (localFilePath.fileExists());
            localFilePath.file_Delete();
            Assert.IsFalse  (localFilePath.fileExists());
            Assert.IsNotNull(qaConfigLoader.load());
            Assert.IsTrue   (localFilePath.fileExists());

            //delete temp folder
            Assert.IsTrue  (tmpFolder.dirExists());
            Assert.IsTrue  (Files.deleteFolder(tmpFolder, true));
            Assert.IsFalse(tmpFolder.dirExists());
        }
Example #8
0
        public static TM_QA_Config                  create(this TM_QA_Config_Loader configLoader)
        {
            var tmQaConfig = new TM_QA_Config()
            {
                Url_Target_TM_Site  = "http://*****:*****@securityinnovation.com",
                Default_Admin_User  = Tests_Consts.DEFAULT_ADMIN_USERNAME,
                Default_Admin_Pwd   = Tests_Consts.DEFAULT_ADMIN_PASSWORD,
            };

            var targetFile = configLoader.localFilePath();

            targetFile.parentFolder().createDir();              // ensure that is exists

            tmQaConfig.addDefaultTestUsers()
            .saveAs(targetFile);
            return(tmQaConfig);
        }
Example #9
0
 public static bool                          serverOnline(this TM_QA_Config tmQaConfig)
 {
     return(tmQaConfig.serverOnline(tmQaConfig.Url_Target_TM_Site.uri()));
 }
Example #10
0
 public static bool                          serverOffline(this TM_QA_Config tmQaConfig, Uri targetServer)
 {
     return(tmQaConfig.serverOnline(targetServer).isFalse());
 }
Example #11
0
 public static List <Test_User> new_UserList(this TM_QA_Config tmQaConfig)
 {
     return(tmQaConfig.TestUsers = new List <Test_User>());
 }
Example #12
0
 public static Test_User        testUser(this TM_QA_Config tmQaConfig, string userName)
 {
     return((from testUser in tmQaConfig.TestUsers
             where testUser.UserName == userName
             select testUser).first());
 }
Example #13
0
 //Test users
 public static List <Test_User> testUsers(this TM_QA_Config tmQaConfig)
 {
     return(tmQaConfig.TestUsers);
 }
Example #14
0
        public static TM_QA_Config create(this TM_QA_Config_Loader configLoader          )
        {
            var tmQaConfig = new TM_QA_Config()
                {
                    Url_Target_TM_Site   = "http://*****:*****@securityinnovation.com",
                    Default_Admin_User   = Tests_Consts.DEFAULT_ADMIN_USERNAME,
                    Default_Admin_Pwd    = Tests_Consts.DEFAULT_ADMIN_PASSWORD,
                };

            var targetFile   = configLoader.localFilePath();
            targetFile.parentFolder().createDir();              // ensure that is exists

            tmQaConfig.addDefaultTestUsers()
                      .saveAs(targetFile);
            return tmQaConfig;
        }
        public void setup()
        {
            qaConfigLoader = new TM_QA_Config_Loader();
            qaConfig       = new TM_QA_Config_Loader().load();

            Assert.IsNotNull(qaConfigLoader);
            Assert.IsNotNull(qaConfig);
            Assert.IsFalse  (TM_QA_Config.Force_Server_Offline);
        }