diff options
author | DUVAL Thomas <thomas.duval@orange.com> | 2016-06-16 14:37:22 +0200 |
---|---|---|
committer | DUVAL Thomas <thomas.duval@orange.com> | 2016-06-16 14:37:22 +0200 |
commit | 7b2562f07f305c18878c77ddcc425a5a32a60186 (patch) | |
tree | 0b95e63757d8d9825063ffda9ee5eb2edac846b5 /moonclient | |
parent | 2e7b4f2027a1147ca28301e4f88adf8274b39a1f (diff) |
update tests on Moonclient
Change-Id: I11dee646deec20423411c5bcaf4b8e694622bd79
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/shell.py | 4 | ||||
-rw-r--r-- | moonclient/moonclient/tests.py | 5 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_empty_policy_new_user.json | 41 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_empty_policy_nova.json | 4 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_empty_policy_swift.json | 4 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_subjects.json | 4 |
6 files changed, 45 insertions, 17 deletions
diff --git a/moonclient/moonclient/shell.py b/moonclient/moonclient/shell.py index 79f9a244..fa675dd9 100644 --- a/moonclient/moonclient/shell.py +++ b/moonclient/moonclient/shell.py @@ -188,7 +188,7 @@ class MoonClient(App): finally: self.log.debug(str(content)) - def auth_keystone(self, username=None, password=None, host=None, port=None): + def auth_keystone(self, username=None, password=None, host=None, port=None, tenant=None): """Send a new authentication request to Keystone :param username: user identification name @@ -198,6 +198,8 @@ class MoonClient(App): self.post["auth"]["identity"]["password"]["user"]["name"] = username if password: self.post["auth"]["identity"]["password"]["user"]["password"] = password + if tenant: + self.post["auth"]["scope"]["project"]["name"] = tenant if host: self.host = host if port: diff --git a/moonclient/moonclient/tests.py b/moonclient/moonclient/tests.py index e2824fa5..5a33130c 100644 --- a/moonclient/moonclient/tests.py +++ b/moonclient/moonclient/tests.py @@ -117,6 +117,7 @@ class TestsLaunch(Lister): if "auth_name" in test or "auth_password" in test or "auth_url" in test: username = None password = None + tenant = None host = None port = None description = "" @@ -124,13 +125,15 @@ class TestsLaunch(Lister): username = test["auth_name"] if "auth_password" in test: password = test["auth_password"] + if "auth_tenant" in test: + tenant = test["auth_tenant"] if "auth_host" in test: host = test["auth_host"] if "auth_port" in test: port = test["auth_port"] if "description" in test: description = test["description"] - self.app.auth_keystone(username, password, host, port) + self.app.auth_keystone(username, password, host, port, tenant) title = "Change auth to " if username: title += username diff --git a/moonclient/moonclient/tests/tests_empty_policy_new_user.json b/moonclient/moonclient/tests/tests_empty_policy_new_user.json index 69f4e161..6caf34ee 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_new_user.json +++ b/moonclient/moonclient/tests/tests_empty_policy_new_user.json @@ -4,18 +4,32 @@ "authz": [ { "auth_name": "admin", + "auth_password": "password", + "auth_tenant": "admin", "description": "Change user to admin (just in case...)" }, { "name": "nova image-list", "external_command": "nova image-list", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3.4-x86_64-uec", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3", "description": "Get an Image ID" }, { + "name": "create teannt test", + "external_command": "openstack project create test_moonclient", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3", + "description": "Get an Image ID" + }, + { + "name": "add role admin to demo", + "external_command": "openstack role add --project admin --user demo admin", + "result": "", + "description": "Force the admin role for the user demo on the project admin (for testing purpose)." + }, + { "name": "nova boot new server", - "external_command": "nova boot --flavor m1.micro --image $uuid_image test_moonclient", + "external_command": "nova boot --flavor m1.tiny --image $uuid_image test_moonclient", "result": "\\| OS-EXT-STS\\:vm_state\\s+\\| building", "description": "Boot a new nova server." }, @@ -111,7 +125,7 @@ }, { "name": "add_subject", - "command": "subject add demo --subject_pass nomoresecrete", + "command": "subject add demo --subject_pass password", "result": "", "description": "", "command_options": "" @@ -3187,7 +3201,7 @@ }, { "name": "add_subject", - "command": "subject add demo --subject_pass nomoresecrete", + "command": "subject add demo --subject_pass password", "result": "", "description": "Add demo subject.", "command_options": "" @@ -3354,7 +3368,7 @@ }, { "name": "add_subject", - "command": "subject add demo --subject_pass nomoresecrete", + "command": "subject add demo --subject_pass password", "result": "", "description": "Add demo subject.", "command_options": "" @@ -3368,22 +3382,28 @@ { "name": "demo: check nova command", - "external_command": "nova --os-user-name demo list", + "external_command": "nova --os-user-name demo --os-project-name admin list", "result": "test_moonclient", - "description": "Check demo cant list nova servers due to the current rules" + "description": "Check demo can list nova servers due to the current rules" }, { "name": "demo: try to pause nova instance", - "external_command": "nova --os-username demo pause $uuid_server", + "external_command": "nova --os-username demo --os-project-name admin pause $uuid_server", "result": "^$", "description": "Pausing the server must be impossible due to the current rules" }, { "name": "check nova command", - "external_command": "nova --os-user-name demo list", + "external_command": "nova --os-user-name demo --os-project-name admin list", "result": "\\| (?P<uuid_server>[\\w\\-]+)\\s+\\| test_moonclient\\s+\\| ACTIVE\\s+\\| [\\w\\-]+\\s+\\| Running", "description": "Check that nova server is still in running state." }, + { + "name": "pause", + "external_command": "read", + "result": "", + "description": "Pause" + }, { "name": "list tenant", @@ -3409,6 +3429,8 @@ { "auth_name": "demo", + "auth_password": "password", + "auth_tenant": "admin", "description": "Change user to demo" }, @@ -3509,6 +3531,7 @@ { "auth_name": "admin", + "auth_tenant": "admin", "description": "Change user to admin" }, diff --git a/moonclient/moonclient/tests/tests_empty_policy_nova.json b/moonclient/moonclient/tests/tests_empty_policy_nova.json index fdab951f..521b1f1d 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_nova.json +++ b/moonclient/moonclient/tests/tests_empty_policy_nova.json @@ -106,7 +106,7 @@ }, { "name": "add_subject", - "command": "subject add admin --password nomoresecrete", + "command": "subject add admin --subject_pass password", "result": "", "description": "", "command_options": "" @@ -119,7 +119,7 @@ }, { "name": "add_subject", - "command": "subject add demo --password nomoresecrete", + "command": "subject add demo --subject_pass password", "result": "", "description": "", "command_options": "" diff --git a/moonclient/moonclient/tests/tests_empty_policy_swift.json b/moonclient/moonclient/tests/tests_empty_policy_swift.json index 5ee1833d..4c9e1315 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_swift.json +++ b/moonclient/moonclient/tests/tests_empty_policy_swift.json @@ -93,7 +93,7 @@ }, { "name": "add_subject", - "command": "subject add admin --password nomoresecrete", + "command": "subject add admin --subject_pass password", "result": "", "description": "", "command_options": "" @@ -106,7 +106,7 @@ }, { "name": "add_subject", - "command": "subject add demo --password nomoresecrete", + "command": "subject add demo --subject_pass password", "result": "", "description": "", "command_options": "" diff --git a/moonclient/moonclient/tests/tests_subjects.json b/moonclient/moonclient/tests/tests_subjects.json index 5543372f..97a45da6 100644 --- a/moonclient/moonclient/tests/tests_subjects.json +++ b/moonclient/moonclient/tests/tests_subjects.json @@ -62,7 +62,7 @@ }, { "name": "add_subject", - "command": "subject add alt_demo --password nomoresecrete", + "command": "subject add alt_demo --subject_pass password", "result": "", "description": "Add the alt_demo subject", "command_options": "" @@ -191,7 +191,7 @@ }, { "name": "add_subject", - "command": "subject add alt_demo --password nomoresecrete", + "command": "subject add alt_demo --subject_pass password", "result": "", "description": "Add the alt_demo subject", "command_options": "" |