コード例 #1
0
    def test_hcp_create_update_role(self):
        # Create user
        name = 'hcp_user' + str(random.randint(1024, 4096))
        password = '******' + str(random.randint(1024, 4096))
        familyname = 'hcp_family_name' + str(random.randint(1024, 4096))
        givenname = 'hcp_given_name' + str(random.randint(1024, 4096))
        email = '*****@*****.**'
        role = 'user'
        out, err = hcp_users.add_user(name,
                                      password,
                                      familyname,
                                      givenname,
                                      email,
                                      optional_args={'--role=': role})
        self.verify('Successfully added user ' + name + ' with role ' + role,
                    out)
        # Update user
        updated_role = 'admin'
        out, err = hcp_users.update_user(
            name, optional_args={'--newrole=': updated_role})
        self.verify('Updated user ' + name + ' successfully', out)
        # Connect to hcp with new creds
        out, err = hcp_auth.login(name, optional_args={'-p=': password})
        self.verify('Logged in successfully.', out)

        # Connect to hcp with default creds to delete the updated user
        out, err = hcp_auth.login(self.username,
                                  optional_args={'-p=': self.password})
        self.verify('Logged in successfully.', out)
        # Delete User
        out, err = hcp_users.delete_user(name)
        self.verify('Deleted user ' + name + ' successfully', out)
コード例 #2
0
 def test_hcp_login_with_non_existing_user(self):
     # Create user
     name = 'hcp_user' + str(random.randint(1024, 4096))
     password = '******' + str(random.randint(1024, 4096))
     familyname = 'hcp_family_name' + str(random.randint(1024, 4096))
     givenname = 'hcp_given_name' + str(random.randint(1024, 4096))
     email = '*****@*****.**'
     role = 'user'
     out, err = hcp_users.add_user(name,
                                   password,
                                   familyname,
                                   givenname,
                                   email,
                                   optional_args={'--role=': role})
     self.verify('Successfully added user ' + name + ' with role ' + role,
                 out)
     # Delete User
     out, err = hcp_users.delete_user(name)
     self.verify('Deleted user ' + name + ' successfully', out)
     # Login with non-existing user
     out, err = hcp_auth.login(name, optional_args={'-p=': password})
     self.verify('Credentials were rejected', err)
コード例 #3
0
    def test_hcp_delete_non_existing_user(self):
        # Create and delete hcp user
        name = 'hcp_user' + str(random.randint(1024, 4096))
        password = '******' + str(random.randint(1024, 4096))
        familyname = 'hcp_family_name' + str(random.randint(1024, 4096))
        givenname = 'hcp_given_name' + str(random.randint(1024, 4096))
        email = '*****@*****.**'
        role = 'user'
        out, err = hcp_users.add_user(name,
                                      password,
                                      familyname,
                                      givenname,
                                      email,
                                      optional_args={'--role=': role})
        self.verify('Successfully added user ' + name + ' with role ' + role,
                    out)
        # Delete user
        out, err = hcp_users.delete_user(name)
        self.verify('Deleted user ' + name + ' successfully', out)

        # Verify deletion of non-existing user
        out, err = hcp_users.delete_user(name)
        self.verify('Unable to delete user: User not found', err)