diff options
author | Jeremy Liu <liujiong@gohighsec.com> | 2016-11-28 10:32:42 +0800 |
---|---|---|
committer | Jeremy Liu <liujiong@gohighsec.com> | 2017-06-20 10:59:08 +0800 |
commit | 97906c853ee7e431b2684c37a0724d42e1c6a245 (patch) | |
tree | 58059994d46a0bbb1466c0bf54fb6069913f657b /functionaltests | |
parent | 83eb7b3b3a80873b6f33e89b885e6af1f931717c (diff) | |
download | python-barbicanclient-97906c853ee7e431b2684c37a0724d42e1c6a245.tar.gz |
Refactor barbicanclient
Add v1 directory for APIs, CLIs and API testcases.
Currently, v1 is supported and the default api version. If version is not
specified when constructing barbicanclient, default api version will be used.
Implements: blueprint refactor-barbicanclient
Change-Id: Ib91e7049de007f4d4254abcd4c125b4dc7e03c55
Diffstat (limited to 'functionaltests')
-rw-r--r-- | functionaltests/client/test_client_connectivity.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/functionaltests/client/test_client_connectivity.py b/functionaltests/client/test_client_connectivity.py index 5f3df4f..482db57 100644 --- a/functionaltests/client/test_client_connectivity.py +++ b/functionaltests/client/test_client_connectivity.py @@ -150,20 +150,27 @@ class WhenTestingClientConnectivity(BaseTestCase): self.assert_client_cannot_get_endpoint(barbicanclient) - def test_client_cannot_access_server_if_nonexistent_version_specified(self): # noqa - barbicanclient_1 = client.Client( + def test_cannot_create_client_if_nonexistent_version_specified(self): + self.assertRaises(exceptions.UnsupportedVersion, + client.Client, + **{"project_id": CONF.keymanager.project_id, + "auth": self.auth, + "interface": client._DEFAULT_SERVICE_INTERFACE, + "service_type": client._DEFAULT_SERVICE_TYPE, + "version": 'wrong-version'}) + + self.assertRaises(exceptions.UnsupportedVersion, + client.Client, + **{"endpoint": CONF.keymanager.url, + "project_id": CONF.keymanager.project_id, + "auth": self.auth, + "version": 'nonexistent_version'}) + + def test_client_can_access_server_if_no_version_is_specified(self): + barbicanclient = client.Client( project_id=CONF.keymanager.project_id, auth=self.auth, interface=client._DEFAULT_SERVICE_INTERFACE, - service_type=client._DEFAULT_SERVICE_TYPE, - version='wrong-version') - - self.assertRaises(TypeError, barbicanclient_1.containers.list) - - barbicanclient_2 = client.Client( - endpoint=CONF.keymanager.url, - project_id=CONF.keymanager.project_id, - auth=self.auth, - version='nonexistent_version') + service_type=client._DEFAULT_SERVICE_TYPE) - self.assert_client_cannot_contact_barbican(barbicanclient_2) + self.assert_client_can_contact_barbican(barbicanclient) |