summaryrefslogtreecommitdiffstats
path: root/test/functional_auth/gswauth/test_gswauth_cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional_auth/gswauth/test_gswauth_cli.py')
-rw-r--r--test/functional_auth/gswauth/test_gswauth_cli.py76
1 files changed, 71 insertions, 5 deletions
diff --git a/test/functional_auth/gswauth/test_gswauth_cli.py b/test/functional_auth/gswauth/test_gswauth_cli.py
index 4e99e38..d07b9c3 100644
--- a/test/functional_auth/gswauth/test_gswauth_cli.py
+++ b/test/functional_auth/gswauth/test_gswauth_cli.py
@@ -438,11 +438,6 @@ class TestUser(unittest.TestCase):
self.assertNotEqual(status, 0, 'user creation succeeded with user of other account: '+output)
self.assertEqual('403 Forbidden' in output,True, 'user creation succeeded with user of other account: '+output)
- #update password of own regular user
- (status,output)=Utils.addUser('test', 'tester', 'testingupdated', user='test:tester', key='testing')
- self.assertNotEqual(status, 0, 'regular user update password succeeded with own credentials: '+output)
- self.assertEqual('403 Forbidden' in output,True, 'regular user update password succeeded with own credentials: '+output)
-
def testDeleteUser(self):
#set test acc
self.setTestAccUserEnv()
@@ -577,3 +572,74 @@ class TestUser(unittest.TestCase):
(status,output) = Utils.deleteUser('test', 'usertobedeletedbyitself',user='test:usertobedeletedbyitself',key='testing')
self.assertEqual(status, 0, 'user deletion failed with own credentials : '+output)
+ def testChangeKey(self):
+ # Create account and users
+ (status, output) = Utils.addAccount('test')
+ self.assertEqual(status, 0, 'Account creation failed: ' + output)
+
+ (status, output) = Utils.addAdminUser('test', 'admin', 'password')
+ self.assertEqual(status, 0, 'User addition failed: ' + output)
+
+ (status, output) = Utils.addUser('test', 'user', 'password')
+ self.assertEqual(status, 0, 'User addition failed: ' + output)
+
+ (status, output) = Utils.addResellerAdminUser('test', 'radmin', 'password')
+ self.assertEqual(status, 0, 'User addition failed: ' + output)
+
+ # Change acccount admin password/key
+ (status, output) = Utils.addAdminUser('test', 'admin', 'new_password', user='test:admin', key='password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Change regular user password/key
+ (status, output) = Utils.addUser('test', 'user', 'new_password', user='test:user', key='password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Change reseller admin password/key
+ (status, output) = Utils.addResellerAdminUser('test', 'radmin', 'new_password', user='test:radmin', key='password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # To verify that password was changed for real, re-run the above commands, but with the new password
+ # Change acccount admin password/key using the new password
+ (status, output) = Utils.addAdminUser('test', 'admin', 'password', user='test:admin', key='new_password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Change regular user password/key using the new password
+ (status, output) = Utils.addUser('test', 'user', 'password', user='test:user', key='new_password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Change reseller admin password/key using the new password
+ (status, output) = Utils.addResellerAdminUser('test', 'radmin', 'password', user='test:radmin', key='new_password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Make sure that regular user cannot upgrade to admin
+ (status, output) = Utils.addAdminUser('test', 'user', 'password', user='test:user', key='password')
+ self.assertEqual('User creation failed' in output, True, 'Update key failed: ' + output)
+
+ # Make sure that regular user cannot upgrade to reseller_admin
+ (status, output) = Utils.addResellerAdminUser('test', 'user', 'password', user='test:user', key='password')
+ self.assertEqual('User creation failed' in output, True, 'Update key failed: ' + output)
+
+ # Make sure admin cannot update himself to reseller_admin
+ (status, output) = Utils.addResellerAdminUser('test', 'admin', 'password', user='test:admin', key='password')
+ self.assertEqual('User creation failed' in output, True, 'Update key failed: ' + output)
+
+ # Account admin changing regular user password/key
+ (status, output) = Utils.addUser('test', 'user', 'new_password', user='test:admin', key='password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+ # Verify by running the command with new password
+ (status, output) = Utils.addUser('test', 'user', 'password', user='test:user', key='new_password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Reseller admin changing regular user password/key
+ (status, output) = Utils.addUser('test', 'user', 'new_password', user='test:radmin', key='password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+ # Verify by running the command with new password
+ (status, output) = Utils.addUser('test', 'user', 'password', user='test:user', key='new_password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+
+ # Reseller admin changing account admin password/key
+ (status, output) = Utils.addAdminUser('test', 'admin', 'new_password', user='test:radmin', key='password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)
+ # Verify by running the command with new password
+ (status, output) = Utils.addAdminUser('test', 'admin', 'password', user='test:admin', key='new_password')
+ self.assertEqual(status, 0, 'Update key failed: ' + output)