public static int add_User(this TM_WebServices webServices, string username, 	string password)
        {
            var newUser = new NewUser
                {
                    Username = username,
                    Password = password,
                    Email    = "{0}@{1}.com".format(10.randomLetters(), 10.randomLetters()),
                };

            return webServices.add_User(newUser);
        }
        public static int add_User(this TM_WebServices webServices, NewUser newUser)
        {
            var userValidationErrors = webServices.CreateUser_Validate(newUser);
            if (userValidationErrors.notEmpty())
            {
                "[add_User] There where validations: {0}".error(userValidationErrors.asString());
                return -1;
            }
            var userId =  webServices.CreateUser(newUser);

            return userId;
        }
示例#3
0
 /// <remarks/>
 public void CreateUsersAsync(NewUser[] newUsers, object userState) {
     if ((this.CreateUsersOperationCompleted == null)) {
         this.CreateUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateUsersOperationCompleted);
     }
     this.InvokeAsync("CreateUsers", new object[] {
                 newUsers}, this.CreateUsersOperationCompleted, userState);
 }
示例#4
0
        public void TM_QA_Config_Setup_TestUsers()
        {
            Assert.IsTrue   (QAConfig.Url_Target_TM_Site.valid());        // target server is set
            Assert.IsTrue   (QAConfig.Default_Admin_User.valid());        // we have an admin username and password
            Assert.IsTrue   (QAConfig.Default_Admin_Pwd .valid());
            Assert.AreEqual (QAConfig.TestUsers.size() , 3      );        // there are test users
            Assert.IsNull   (webServices.Cached_CurrentUser     );        // not logged in

            //login as admin
            Assert.IsTrue   (webServices.login_with_Pwd(QAConfig.Default_Admin_User, QAConfig.Default_Admin_Pwd));
            Assert.IsTrue   (webServices.RBAC_IsAdmin());

            var adminUser  = webServices.Cached_CurrentUser;

            Assert.IsNotNull(adminUser);
            Assert.AreEqual (adminUser.UserName,QAConfig.Default_Admin_User);

            foreach(var testUser in QAConfig.testUsers())
            {
                var tmUser = webServices.user(testUser.UserName);
                if(tmUser.notNull())
                    webServices.delete_User(tmUser);

                var newUser = new NewUser
                    {
                        Username = testUser.UserName,
                        Password = testUser.Password,
                        Email    = testUser.Email,
                        GroupId  = testUser.GroupId,
                    };
                var userId = webServices.add_User(newUser);
                Assert.Greater(userId,0);

                tmUser = webServices.user(testUser.UserName);

                Assert.IsNotNull(tmUser);

                testUser.UserId    = tmUser.UserId;
                testUser.AuthToken = webServices.user_AuthToken(tmUser.UserId);
            }
            QAConfig.save_QAConfig();
        }
示例#5
0
 /// <remarks/>
 public void CreateUsersAsync(NewUser[] newUsers) {
     this.CreateUsersAsync(newUsers, null);
 }
示例#6
0
 public TM_User[] CreateUsers(NewUser[] newUsers) {
     object[] results = this.Invoke("CreateUsers", new object[] {
                 newUsers});
     return ((TM_User[])(results[0]));
 }
示例#7
0
 /// <remarks/>
 public void CreateUser_ValidateAsync(NewUser newUser) {
     this.CreateUser_ValidateAsync(newUser, null);
 }
示例#8
0
 public string[] CreateUser_Validate(NewUser newUser) {
     object[] results = this.Invoke("CreateUser_Validate", new object[] {
                 newUser});
     return ((string[])(results[0]));
 }
示例#9
0
 public int CreateUser(NewUser newUser) {
     object[] results = this.Invoke("CreateUser", new object[] {
                 newUser});
     return ((int)(results[0]));
 }