diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2013-11-15 17:40:09 -0600 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2013-11-18 22:11:10 -0600 |
| commit | 6460f1eb359d37dc43bdbb7d3eacc6c3f5cd7ede (patch) | |
| tree | 1720ee65c6da418586dbffc8d53b860df6ae21e0 /openstackclient/tests/identity | |
| parent | c946192e37111aa381097256c1fd1fb91e356783 (diff) | |
| download | python-openstackclient-6460f1eb359d37dc43bdbb7d3eacc6c3f5cd7ede.tar.gz | |
Complete basic test infrastructure
This finally gets all of the API tests into a common framework regarding
test classes and so forth.
Change-Id: If675347129c50dcba0bfc5b6c58f5a2ca57ff46c
Diffstat (limited to 'openstackclient/tests/identity')
| -rw-r--r-- | openstackclient/tests/identity/v2_0/fakes.py | 12 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v2_0/test_identity.py | 31 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v2_0/test_project.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v2_0/test_role.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v2_0/test_service.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v2_0/test_user.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v3/fakes.py | 11 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v3/test_identity.py | 31 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v3/test_project.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v3/test_role.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v3/test_service.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v3/test_user.py | 3 |
12 files changed, 31 insertions, 78 deletions
diff --git a/openstackclient/tests/identity/v2_0/fakes.py b/openstackclient/tests/identity/v2_0/fakes.py index b1aeabd4..80febd29 100644 --- a/openstackclient/tests/identity/v2_0/fakes.py +++ b/openstackclient/tests/identity/v2_0/fakes.py @@ -16,6 +16,8 @@ import mock from openstackclient.tests import fakes +from openstackclient.tests import utils + project_id = '8-9-64' project_name = 'beatles' @@ -83,3 +85,13 @@ class FakeIdentityv2Client(object): self.ec2.resource_class = fakes.FakeResource(None, {}) self.auth_token = kwargs['token'] self.management_url = kwargs['endpoint'] + + +class TestIdentityv2(utils.TestCommand): + def setUp(self): + super(TestIdentityv2, self).setUp() + + self.app.client_manager.identity = FakeIdentityv2Client( + endpoint=fakes.AUTH_URL, + token=fakes.AUTH_TOKEN, + ) diff --git a/openstackclient/tests/identity/v2_0/test_identity.py b/openstackclient/tests/identity/v2_0/test_identity.py deleted file mode 100644 index 8a50a48a..00000000 --- a/openstackclient/tests/identity/v2_0/test_identity.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2013 Nebula Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -from openstackclient.tests.identity.v2_0 import fakes -from openstackclient.tests import utils - - -AUTH_TOKEN = "foobar" -AUTH_URL = "http://0.0.0.0" - - -class TestIdentityv2(utils.TestCommand): - def setUp(self): - super(TestIdentityv2, self).setUp() - - self.app.client_manager.identity = fakes.FakeIdentityv2Client( - endpoint=AUTH_URL, - token=AUTH_TOKEN, - ) diff --git a/openstackclient/tests/identity/v2_0/test_project.py b/openstackclient/tests/identity/v2_0/test_project.py index 933bd094..30f4278b 100644 --- a/openstackclient/tests/identity/v2_0/test_project.py +++ b/openstackclient/tests/identity/v2_0/test_project.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v2_0 import project from openstackclient.tests import fakes from openstackclient.tests.identity.v2_0 import fakes as identity_fakes -from openstackclient.tests.identity.v2_0 import test_identity -class TestProject(test_identity.TestIdentityv2): +class TestProject(identity_fakes.TestIdentityv2): def setUp(self): super(TestProject, self).setUp() diff --git a/openstackclient/tests/identity/v2_0/test_role.py b/openstackclient/tests/identity/v2_0/test_role.py index 56e9d4cb..d515bd7c 100644 --- a/openstackclient/tests/identity/v2_0/test_role.py +++ b/openstackclient/tests/identity/v2_0/test_role.py @@ -20,10 +20,9 @@ from openstackclient.common import exceptions from openstackclient.identity.v2_0 import role from openstackclient.tests import fakes from openstackclient.tests.identity.v2_0 import fakes as identity_fakes -from openstackclient.tests.identity.v2_0 import test_identity -class TestRole(test_identity.TestIdentityv2): +class TestRole(identity_fakes.TestIdentityv2): def setUp(self): super(TestRole, self).setUp() diff --git a/openstackclient/tests/identity/v2_0/test_service.py b/openstackclient/tests/identity/v2_0/test_service.py index f09c4137..6c93574b 100644 --- a/openstackclient/tests/identity/v2_0/test_service.py +++ b/openstackclient/tests/identity/v2_0/test_service.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v2_0 import service from openstackclient.tests import fakes from openstackclient.tests.identity.v2_0 import fakes as identity_fakes -from openstackclient.tests.identity.v2_0 import test_identity -class TestService(test_identity.TestIdentityv2): +class TestService(identity_fakes.TestIdentityv2): def setUp(self): super(TestService, self).setUp() diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py index 2fe585ed..a18d13d8 100644 --- a/openstackclient/tests/identity/v2_0/test_user.py +++ b/openstackclient/tests/identity/v2_0/test_user.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v2_0 import user from openstackclient.tests import fakes from openstackclient.tests.identity.v2_0 import fakes as identity_fakes -from openstackclient.tests.identity.v2_0 import test_identity -class TestUser(test_identity.TestIdentityv2): +class TestUser(identity_fakes.TestIdentityv2): def setUp(self): super(TestUser, self).setUp() diff --git a/openstackclient/tests/identity/v3/fakes.py b/openstackclient/tests/identity/v3/fakes.py index 13385536..9d40d9db 100644 --- a/openstackclient/tests/identity/v3/fakes.py +++ b/openstackclient/tests/identity/v3/fakes.py @@ -16,6 +16,7 @@ import mock from openstackclient.tests import fakes +from openstackclient.tests import utils domain_id = 'd1' @@ -104,3 +105,13 @@ class FakeIdentityv3Client(object): self.users.resource_class = fakes.FakeResource(None, {}) self.auth_token = kwargs['token'] self.management_url = kwargs['endpoint'] + + +class TestIdentityv3(utils.TestCommand): + def setUp(self): + super(TestIdentityv3, self).setUp() + + self.app.client_manager.identity = FakeIdentityv3Client( + endpoint=fakes.AUTH_URL, + token=fakes.AUTH_TOKEN, + ) diff --git a/openstackclient/tests/identity/v3/test_identity.py b/openstackclient/tests/identity/v3/test_identity.py deleted file mode 100644 index 4b55ee45..00000000 --- a/openstackclient/tests/identity/v3/test_identity.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2013 Nebula Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -from openstackclient.tests.identity.v3 import fakes -from openstackclient.tests import utils - - -AUTH_TOKEN = "foobar" -AUTH_URL = "http://0.0.0.0" - - -class TestIdentityv3(utils.TestCommand): - def setUp(self): - super(TestIdentityv3, self).setUp() - - self.app.client_manager.identity = fakes.FakeIdentityv3Client( - endpoint=AUTH_URL, - token=AUTH_TOKEN, - ) diff --git a/openstackclient/tests/identity/v3/test_project.py b/openstackclient/tests/identity/v3/test_project.py index 91c15e24..02cb41be 100644 --- a/openstackclient/tests/identity/v3/test_project.py +++ b/openstackclient/tests/identity/v3/test_project.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v3 import project from openstackclient.tests import fakes from openstackclient.tests.identity.v3 import fakes as identity_fakes -from openstackclient.tests.identity.v3 import test_identity -class TestProject(test_identity.TestIdentityv3): +class TestProject(identity_fakes.TestIdentityv3): def setUp(self): super(TestProject, self).setUp() diff --git a/openstackclient/tests/identity/v3/test_role.py b/openstackclient/tests/identity/v3/test_role.py index ef2b3e05..040c39dd 100644 --- a/openstackclient/tests/identity/v3/test_role.py +++ b/openstackclient/tests/identity/v3/test_role.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v3 import role from openstackclient.tests import fakes from openstackclient.tests.identity.v3 import fakes as identity_fakes -from openstackclient.tests.identity.v3 import test_identity -class TestRole(test_identity.TestIdentityv3): +class TestRole(identity_fakes.TestIdentityv3): def setUp(self): super(TestRole, self).setUp() diff --git a/openstackclient/tests/identity/v3/test_service.py b/openstackclient/tests/identity/v3/test_service.py index 1c3ae21e..10d249c5 100644 --- a/openstackclient/tests/identity/v3/test_service.py +++ b/openstackclient/tests/identity/v3/test_service.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v3 import service from openstackclient.tests import fakes from openstackclient.tests.identity.v3 import fakes as identity_fakes -from openstackclient.tests.identity.v3 import test_identity -class TestService(test_identity.TestIdentityv3): +class TestService(identity_fakes.TestIdentityv3): def setUp(self): super(TestService, self).setUp() diff --git a/openstackclient/tests/identity/v3/test_user.py b/openstackclient/tests/identity/v3/test_user.py index 8f195805..4321b047 100644 --- a/openstackclient/tests/identity/v3/test_user.py +++ b/openstackclient/tests/identity/v3/test_user.py @@ -18,10 +18,9 @@ import copy from openstackclient.identity.v3 import user from openstackclient.tests import fakes from openstackclient.tests.identity.v3 import fakes as identity_fakes -from openstackclient.tests.identity.v3 import test_identity -class TestUser(test_identity.TestIdentityv3): +class TestUser(identity_fakes.TestIdentityv3): def setUp(self): super(TestUser, self).setUp() |
