diff options
| -rw-r--r-- | test/functional/base.py | 24 | ||||
| -rwxr-xr-x | test/functional/run_tests.py | 22 |
2 files changed, 36 insertions, 10 deletions
diff --git a/test/functional/base.py b/test/functional/base.py index d30134bc..e0c185ac 100644 --- a/test/functional/base.py +++ b/test/functional/base.py @@ -18,12 +18,13 @@ import dtest import ksapi +import simplerest options = None -def _get_ksapi(): +def _get_ksapi(url): """Get an instance of KeystoneAPI20.""" # If debug mode has been enabled, let's select a debug stream @@ -32,7 +33,7 @@ def _get_ksapi(): dbstream = dtest.status # Build and return the API object - return ksapi.KeystoneAPI20(options.keystone, dbstream) + return ksapi.KeystoneAPI20(url, dbstream) class BaseKeystoneTest(dtest.DTestCase): @@ -41,8 +42,9 @@ class BaseKeystoneTest(dtest.DTestCase): def setUp(self): """Initialize tests by setting up a KeystoneAPI20 to call.""" - # Build the API object - self.ks = _get_ksapi() + # Build the API objects + self.ks = _get_ksapi(options.keystone) + self.ks_admin = _get_ksapi(options.keystone_admin) class KeystoneTest(BaseKeystoneTest): @@ -55,7 +57,7 @@ class KeystoneTest(BaseKeystoneTest): """Initialize tests by setting up a keystone token.""" # Get an API object - ks = _get_ksapi() + ks = _get_ksapi(options.keystone) # Next, let's authenticate resp = ks.authenticate(options.username, options.password) @@ -68,10 +70,14 @@ class KeystoneTest(BaseKeystoneTest): """Revoke the authentication token.""" # Get an API object - ks = _get_ksapi() - - # Now, let's revoke the token - resp = ks.revoke_token(cls.token, cls.token) + ks = _get_ksapi(options.keystone_admin) + + try: + # Now, let's revoke the user token + resp = ks.revoke_token(cls.token, cls.token) + except simplerest.RESTException: + # Ignore errors revoking the token + pass # For completeness sake... cls.token = None diff --git a/test/functional/run_tests.py b/test/functional/run_tests.py index 944ddcc1..86b9ec92 100755 --- a/test/functional/run_tests.py +++ b/test/functional/run_tests.py @@ -35,9 +35,21 @@ def add_opts(opts): opts.add_option("-p", "--password", action="store", type="string", dest="password", help="The password to use to access Keystone.") + + opts.add_option("-U", "--adminuser", + action="store", type="string", dest="adminuser", + help="The admin username to use to access Keystone.") + opts.add_option("-P", "--adminpass", + action="store", type="string", dest="adminpass", + help="The admin password to use to access Keystone.") + opts.add_option("-k", "--keystone", action="store", type="string", dest="keystone", - help="The URL to use to access Keystone.") + help="The URL to use to access the Keystone service.") + opts.add_option("-K", "--keystone-admin", + action="store", type="string", dest="keystone_admin", + help="The URL to use to access the Keystone admin " + "service.") return opts @@ -59,5 +71,13 @@ if __name__ == '__main__': opts.print_help(sys.stderr) sys.exit(1) + # How about the admin stuff? + if not base.options.adminuser: + base.options.adminuser = base.options.username + if not base.options.adminpass: + base.options.adminpass = base.options.password + if not base.options.keystone_admin: + base.options.keystone_admin = base.options.keystone + # Execute the test suite sys.exit(dtest.main(**dtest.opts_to_args(base.options))) |
