Esempio n. 1
0
 def test_user_ops(self):
     test_user = get_random_string()
     test_role = get_random_string()
     # create
     assert utils.create_user(username=test_user, password='******', role=test_role)
     assert utils.get_user(test_user) != None
     # toggle
     assert utils.toggle_user(test_user, False)
     user_data = json.loads(utils.get_user(test_user))
     assert user_data['enabled'] == False
     assert utils.toggle_user(test_user, True)
     user_data = json.loads(utils.get_user(test_user))
     assert user_data['enabled'] == True
     assert utils.toggle_user(test_user)
     user_data = json.loads(utils.get_user(test_user))
     assert user_data['enabled'] == False
     # delete
     assert utils.delete_user(test_user)
     assert utils.get_user(test_user) == None
     assert utils.delete_role(test_role)
Esempio n. 2
0
 def test_role_ops(self):
     test_role = get_random_string()
     assert utils.create_role(test_role)
     assert utils.get_role(test_role) != None
     assert utils.delete_role(test_role)
     assert utils.get_role(test_role) == None
Esempio n. 3
0
def delete_role(rolename):
    try:
        utils.delete_role(rolename)
        flash(messages.ROLE_DELETED, 'success')
    except Exception, e:
        flash('{0} {1}'.format(messages.ERROR_DELETING_ROLE, e), 'error')
Esempio n. 4
0
def delete_role(rolename):
    try:
        utils.delete_role(rolename)
        flash(messages.ROLE_DELETED, 'success')
    except Exception, e:
        flash('{0} {1}'.format(messages.ERROR_DELETING_ROLE, e), 'error')
Esempio n. 5
0
 def test_create_role(self):
     assert utils.create_role(self._test_user_role)
     assert utils.delete_role(self._test_user_role)