From 4793264851a76e826a2d0b90354143ec94132908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Thu, 29 Dec 2016 10:35:08 -0500 Subject: [PATCH] Use same naming convention everywhere for test classes Change-Id: If619973f203a811dedd5fdfd9a6c32373e3afe85 --- almanach/tests/unit/api/auth/test_keystone_auth.py | 4 ++-- almanach/tests/unit/api/auth/test_mixed_auth.py | 4 ++-- almanach/tests/unit/api/auth/test_private_key_auth.py | 4 ++-- almanach/tests/unit/api/test_auth_adapter.py | 5 +++-- almanach/tests/unit/api/v1/__init__.py | 0 almanach/tests/unit/api/{ => v1}/base_api.py | 0 almanach/tests/unit/api/{ => v1}/test_api_authentication.py | 6 +++--- almanach/tests/unit/api/{ => v1}/test_api_entity.py | 4 ++-- almanach/tests/unit/api/{ => v1}/test_api_info.py | 4 ++-- almanach/tests/unit/api/{ => v1}/test_api_instance.py | 4 ++-- almanach/tests/unit/api/{ => v1}/test_api_volume.py | 4 ++-- almanach/tests/unit/api/{ => v1}/test_api_volume_type.py | 4 ++-- .../tests/unit/collector/handlers/test_instance_handler.py | 4 ++-- .../tests/unit/collector/handlers/test_volume_handler.py | 4 ++-- .../unit/collector/handlers/test_volume_type_handler.py | 4 ++-- almanach/tests/unit/collector/test_messaging.py | 4 ++-- almanach/tests/unit/collector/test_notification.py | 4 ++-- almanach/tests/unit/collector/test_service.py | 4 ++-- .../tests/unit/core/controllers/test_entity_controller.py | 4 ++-- .../tests/unit/core/controllers/test_instance_controller.py | 4 ++-- .../tests/unit/core/controllers/test_volume_controller.py | 4 ++-- .../unit/core/controllers/test_volume_type_controller.py | 4 ++-- almanach/tests/unit/core/test_factory.py | 4 ++-- almanach/tests/unit/storage/drivers/test_mongodb_driver.py | 4 ++-- almanach/tests/unit/storage/test_storage_driver.py | 4 ++-- almanach/tests/unit/validators/test_instance_validator.py | 3 ++- 26 files changed, 50 insertions(+), 48 deletions(-) create mode 100644 almanach/tests/unit/api/v1/__init__.py rename almanach/tests/unit/api/{ => v1}/base_api.py (100%) rename almanach/tests/unit/api/{ => v1}/test_api_authentication.py (89%) rename almanach/tests/unit/api/{ => v1}/test_api_entity.py (98%) rename almanach/tests/unit/api/{ => v1}/test_api_info.py (92%) rename almanach/tests/unit/api/{ => v1}/test_api_instance.py (99%) rename almanach/tests/unit/api/{ => v1}/test_api_volume.py (99%) rename almanach/tests/unit/api/{ => v1}/test_api_volume_type.py (97%) diff --git a/almanach/tests/unit/api/auth/test_keystone_auth.py b/almanach/tests/unit/api/auth/test_keystone_auth.py index aad191b..3b32fdc 100644 --- a/almanach/tests/unit/api/auth/test_keystone_auth.py +++ b/almanach/tests/unit/api/auth/test_keystone_auth.py @@ -20,10 +20,10 @@ from almanach.core import exception from almanach.tests.unit import base -class KeystoneAuthenticationTest(base.BaseTestCase): +class TestKeystoneAuthentication(base.BaseTestCase): def setUp(self): - super(KeystoneAuthenticationTest, self).setUp() + super(TestKeystoneAuthentication, self).setUp() self.session_mock = mock.patch('keystoneauth1.session.Session').start() self.keystone_mock = mock.patch('keystoneclient.v3.client.Client').start() diff --git a/almanach/tests/unit/api/auth/test_mixed_auth.py b/almanach/tests/unit/api/auth/test_mixed_auth.py index 7117749..512ede5 100644 --- a/almanach/tests/unit/api/auth/test_mixed_auth.py +++ b/almanach/tests/unit/api/auth/test_mixed_auth.py @@ -23,10 +23,10 @@ from almanach.core import exception from almanach.tests.unit import base -class MixedAuthenticationTest(base.BaseTestCase): +class TestMixedAuthentication(base.BaseTestCase): def setUp(self): - super(MixedAuthenticationTest, self).setUp() + super(TestMixedAuthentication, self).setUp() self.auth_one = flexmock() self.auth_two = flexmock() self.auth_backend = mixed_auth.MixedAuthentication([self.auth_one, self.auth_two]) diff --git a/almanach/tests/unit/api/auth/test_private_key_auth.py b/almanach/tests/unit/api/auth/test_private_key_auth.py index 2841be4..82c5235 100644 --- a/almanach/tests/unit/api/auth/test_private_key_auth.py +++ b/almanach/tests/unit/api/auth/test_private_key_auth.py @@ -22,10 +22,10 @@ from almanach.core import exception from almanach.tests.unit import base -class PrivateKeyAuthenticationTest(base.BaseTestCase): +class TestPrivateKeyAuthentication(base.BaseTestCase): def setUp(self): - super(PrivateKeyAuthenticationTest, self).setUp() + super(TestPrivateKeyAuthentication, self).setUp() self.auth_backend = private_key_auth.PrivateKeyAuthentication("my token") def test_with_correct_token(self): diff --git a/almanach/tests/unit/api/test_auth_adapter.py b/almanach/tests/unit/api/test_auth_adapter.py index 980fd9b..3fbab18 100644 --- a/almanach/tests/unit/api/test_auth_adapter.py +++ b/almanach/tests/unit/api/test_auth_adapter.py @@ -22,9 +22,10 @@ from almanach.api import auth_adapter from almanach.tests.unit import base -class AuthenticationAdapterTest(base.BaseTestCase): +class TestAuthenticationAdapter(base.BaseTestCase): + def setUp(self): - super(AuthenticationAdapterTest, self).setUp() + super(TestAuthenticationAdapter, self).setUp() self.auth_adapter = auth_adapter.AuthenticationAdapter(self.config) def test_assert_that_the_default_backend_is_private_key(self): diff --git a/almanach/tests/unit/api/v1/__init__.py b/almanach/tests/unit/api/v1/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/almanach/tests/unit/api/base_api.py b/almanach/tests/unit/api/v1/base_api.py similarity index 100% rename from almanach/tests/unit/api/base_api.py rename to almanach/tests/unit/api/v1/base_api.py diff --git a/almanach/tests/unit/api/test_api_authentication.py b/almanach/tests/unit/api/v1/test_api_authentication.py similarity index 89% rename from almanach/tests/unit/api/test_api_authentication.py rename to almanach/tests/unit/api/v1/test_api_authentication.py index 7668388..2f17a77 100644 --- a/almanach/tests/unit/api/test_api_authentication.py +++ b/almanach/tests/unit/api/v1/test_api_authentication.py @@ -15,13 +15,13 @@ from hamcrest import assert_that from hamcrest import equal_to -from almanach.tests.unit.api import base_api +from almanach.tests.unit.api.v1 import base_api -class ApiAuthenticationTest(base_api.BaseApi): +class TestApiAuthentication(base_api.BaseApi): def setUp(self): - super(ApiAuthenticationTest, self).setUp() + super(TestApiAuthentication, self).setUp() self.prepare() self.prepare_with_failed_authentication() diff --git a/almanach/tests/unit/api/test_api_entity.py b/almanach/tests/unit/api/v1/test_api_entity.py similarity index 98% rename from almanach/tests/unit/api/test_api_entity.py rename to almanach/tests/unit/api/v1/test_api_entity.py index 18ad007..7f43be4 100644 --- a/almanach/tests/unit/api/test_api_entity.py +++ b/almanach/tests/unit/api/v1/test_api_entity.py @@ -20,12 +20,12 @@ from hamcrest import is_ from voluptuous import Invalid from almanach.core import exception -from almanach.tests.unit.api import base_api +from almanach.tests.unit.api.v1 import base_api from almanach.tests.unit.builders.entity import a from almanach.tests.unit.builders.entity import instance -class ApiEntityTest(base_api.BaseApi): +class TestApiEntity(base_api.BaseApi): def test_update_instance_flavor_for_terminated_instance(self): some_new_flavor = 'some_new_flavor' diff --git a/almanach/tests/unit/api/test_api_info.py b/almanach/tests/unit/api/v1/test_api_info.py similarity index 92% rename from almanach/tests/unit/api/test_api_info.py rename to almanach/tests/unit/api/v1/test_api_info.py index ef36984..7b25169 100644 --- a/almanach/tests/unit/api/test_api_info.py +++ b/almanach/tests/unit/api/v1/test_api_info.py @@ -16,10 +16,10 @@ from hamcrest import assert_that from hamcrest import equal_to from hamcrest import has_key -from almanach.tests.unit.api import base_api +from almanach.tests.unit.api.v1 import base_api -class ApiInfoTest(base_api.BaseApi): +class TestApiInfo(base_api.BaseApi): def test_info(self): self.app_ctl.should_receive('get_application_info').and_return({ diff --git a/almanach/tests/unit/api/test_api_instance.py b/almanach/tests/unit/api/v1/test_api_instance.py similarity index 99% rename from almanach/tests/unit/api/test_api_instance.py rename to almanach/tests/unit/api/v1/test_api_instance.py index 8b21b3d..99d1f9f 100644 --- a/almanach/tests/unit/api/test_api_instance.py +++ b/almanach/tests/unit/api/v1/test_api_instance.py @@ -19,12 +19,12 @@ from hamcrest import has_key from hamcrest import has_length from almanach.core import exception -from almanach.tests.unit.api import base_api +from almanach.tests.unit.api.v1 import base_api from almanach.tests.unit.builders.entity import a from almanach.tests.unit.builders.entity import instance -class ApiInstanceTest(base_api.BaseApi): +class TestApiInstance(base_api.BaseApi): def test_get_instances(self): self.instance_ctl.should_receive('list_instances') \ diff --git a/almanach/tests/unit/api/test_api_volume.py b/almanach/tests/unit/api/v1/test_api_volume.py similarity index 99% rename from almanach/tests/unit/api/test_api_volume.py rename to almanach/tests/unit/api/v1/test_api_volume.py index 519228d..f6fe54c 100644 --- a/almanach/tests/unit/api/test_api_volume.py +++ b/almanach/tests/unit/api/v1/test_api_volume.py @@ -18,10 +18,10 @@ from hamcrest import has_entries from uuid import uuid4 from almanach.core import exception -from almanach.tests.unit.api import base_api +from almanach.tests.unit.api.v1 import base_api -class ApiVolumeTest(base_api.BaseApi): +class TestApiVolume(base_api.BaseApi): def test_successful_volume_create(self): data = dict(volume_id="VOLUME_ID", diff --git a/almanach/tests/unit/api/test_api_volume_type.py b/almanach/tests/unit/api/v1/test_api_volume_type.py similarity index 97% rename from almanach/tests/unit/api/test_api_volume_type.py rename to almanach/tests/unit/api/v1/test_api_volume_type.py index 8709ada..1157861 100644 --- a/almanach/tests/unit/api/test_api_volume_type.py +++ b/almanach/tests/unit/api/v1/test_api_volume_type.py @@ -20,12 +20,12 @@ from hamcrest import has_key from hamcrest import has_length from almanach.core import exception -from almanach.tests.unit.api import base_api +from almanach.tests.unit.api.v1 import base_api from almanach.tests.unit.builders.entity import a from almanach.tests.unit.builders.entity import volume_type -class ApiVolumeTypeTest(base_api.BaseApi): +class TestApiVolumeType(base_api.BaseApi): def test_get_volume_types(self): self.volume_type_ctl.should_receive('list_volume_types') \ diff --git a/almanach/tests/unit/collector/handlers/test_instance_handler.py b/almanach/tests/unit/collector/handlers/test_instance_handler.py index dd99f78..a805e22 100644 --- a/almanach/tests/unit/collector/handlers/test_instance_handler.py +++ b/almanach/tests/unit/collector/handlers/test_instance_handler.py @@ -19,10 +19,10 @@ from almanach.tests.unit import base from almanach.tests.unit.builders import notification as builder -class InstanceHandlerTest(base.BaseTestCase): +class TestInstanceHandler(base.BaseTestCase): def setUp(self): - super(InstanceHandlerTest, self).setUp() + super(TestInstanceHandler, self).setUp() self.controller = mock.Mock() self.instance_handler = instance_handler.InstanceHandler(self.controller) diff --git a/almanach/tests/unit/collector/handlers/test_volume_handler.py b/almanach/tests/unit/collector/handlers/test_volume_handler.py index 6857cec..4fab182 100644 --- a/almanach/tests/unit/collector/handlers/test_volume_handler.py +++ b/almanach/tests/unit/collector/handlers/test_volume_handler.py @@ -19,10 +19,10 @@ from almanach.tests.unit import base from almanach.tests.unit.builders import notification as builder -class VolumeHandlerTest(base.BaseTestCase): +class TestVolumeHandler(base.BaseTestCase): def setUp(self): - super(VolumeHandlerTest, self).setUp() + super(TestVolumeHandler, self).setUp() self.controller = mock.Mock() self.volume_handler = volume_handler.VolumeHandler(self.controller) diff --git a/almanach/tests/unit/collector/handlers/test_volume_type_handler.py b/almanach/tests/unit/collector/handlers/test_volume_type_handler.py index f647331..66e7c59 100644 --- a/almanach/tests/unit/collector/handlers/test_volume_type_handler.py +++ b/almanach/tests/unit/collector/handlers/test_volume_type_handler.py @@ -19,10 +19,10 @@ from almanach.tests.unit import base from almanach.tests.unit.builders import notification as builder -class VolumeTypeHandlerTest(base.BaseTestCase): +class TestVolumeTypeHandler(base.BaseTestCase): def setUp(self): - super(VolumeTypeHandlerTest, self).setUp() + super(TestVolumeTypeHandler, self).setUp() self.controller = mock.Mock() self.volume_type_handler = volume_type_handler.VolumeTypeHandler(self.controller) diff --git a/almanach/tests/unit/collector/test_messaging.py b/almanach/tests/unit/collector/test_messaging.py index 84155c0..0c5dc81 100644 --- a/almanach/tests/unit/collector/test_messaging.py +++ b/almanach/tests/unit/collector/test_messaging.py @@ -19,10 +19,10 @@ from almanach.collector import messaging from almanach.tests.unit import base -class MessagingFactoryTest(base.BaseTestCase): +class TestMessagingFactory(base.BaseTestCase): def setUp(self): - super(MessagingFactoryTest, self).setUp() + super(TestMessagingFactory, self).setUp() self.factory = messaging.MessagingFactory(self.config) def test_get_listener(self): diff --git a/almanach/tests/unit/collector/test_notification.py b/almanach/tests/unit/collector/test_notification.py index 1acb266..f3c3530 100644 --- a/almanach/tests/unit/collector/test_notification.py +++ b/almanach/tests/unit/collector/test_notification.py @@ -18,10 +18,10 @@ from almanach.collector import notification from almanach.tests.unit import base -class NotificationTest(base.BaseTestCase): +class TestNotification(base.BaseTestCase): def setUp(self): - super(NotificationTest, self).setUp() + super(TestNotification, self).setUp() self.config_fixture.config(retry_delay=0, group='collector') self.config_fixture.config(max_retries=3, group='collector') diff --git a/almanach/tests/unit/collector/test_service.py b/almanach/tests/unit/collector/test_service.py index 3080919..d674a9b 100644 --- a/almanach/tests/unit/collector/test_service.py +++ b/almanach/tests/unit/collector/test_service.py @@ -18,10 +18,10 @@ import mock from almanach.tests.unit import base -class ServiceFactoryTest(base.BaseTestCase): +class TestServiceFactory(base.BaseTestCase): def setUp(self): - super(ServiceFactoryTest, self).setUp() + super(TestServiceFactory, self).setUp() self.core_factory = mock.Mock() self.factory = service.ServiceFactory(self.config, self.core_factory) diff --git a/almanach/tests/unit/core/controllers/test_entity_controller.py b/almanach/tests/unit/core/controllers/test_entity_controller.py index 4d56217..7f54fcb 100644 --- a/almanach/tests/unit/core/controllers/test_entity_controller.py +++ b/almanach/tests/unit/core/controllers/test_entity_controller.py @@ -31,10 +31,10 @@ from almanach.tests.unit.builders.entity import a from almanach.tests.unit.builders.entity import instance -class EntityControllerTest(base.BaseTestCase): +class TestEntityController(base.BaseTestCase): def setUp(self): - super(EntityControllerTest, self).setUp() + super(TestEntityController, self).setUp() self.database_adapter = flexmock(base_driver.BaseDriver) self.controller = entity_controller.EntityController(self.database_adapter) diff --git a/almanach/tests/unit/core/controllers/test_instance_controller.py b/almanach/tests/unit/core/controllers/test_instance_controller.py index b0ed08a..7bab2d2 100644 --- a/almanach/tests/unit/core/controllers/test_instance_controller.py +++ b/almanach/tests/unit/core/controllers/test_instance_controller.py @@ -27,10 +27,10 @@ from almanach.tests.unit.builders.entity import a from almanach.tests.unit.builders.entity import instance -class InstanceControllerTest(base.BaseTestCase): +class TestInstanceController(base.BaseTestCase): def setUp(self): - super(InstanceControllerTest, self).setUp() + super(TestInstanceController, self).setUp() self.config.entities.instance_image_meta = ['distro', 'version', 'os_type'] self.database_adapter = flexmock(base_driver.BaseDriver) self.controller = instance_controller.InstanceController(self.config, self.database_adapter) diff --git a/almanach/tests/unit/core/controllers/test_volume_controller.py b/almanach/tests/unit/core/controllers/test_volume_controller.py index 16b0c4e..4bbe054 100644 --- a/almanach/tests/unit/core/controllers/test_volume_controller.py +++ b/almanach/tests/unit/core/controllers/test_volume_controller.py @@ -29,10 +29,10 @@ from almanach.tests.unit.builders.entity import volume from almanach.tests.unit.builders.entity import volume_type -class VolumeControllerTest(base.BaseTestCase): +class TestVolumeController(base.BaseTestCase): def setUp(self): - super(VolumeControllerTest, self).setUp() + super(TestVolumeController, self).setUp() self.database_adapter = flexmock(base_driver.BaseDriver) self.controller = volume_controller.VolumeController(self.config, self.database_adapter) diff --git a/almanach/tests/unit/core/controllers/test_volume_type_controller.py b/almanach/tests/unit/core/controllers/test_volume_type_controller.py index 38884cd..bcebe32 100644 --- a/almanach/tests/unit/core/controllers/test_volume_type_controller.py +++ b/almanach/tests/unit/core/controllers/test_volume_type_controller.py @@ -20,10 +20,10 @@ from almanach.tests.unit.builders.entity import a from almanach.tests.unit.builders.entity import volume_type -class VolumeTypeControllerTest(base.BaseTestCase): +class TestVolumeTypeController(base.BaseTestCase): def setUp(self): - super(VolumeTypeControllerTest, self).setUp() + super(TestVolumeTypeController, self).setUp() self.database_adapter = mock.Mock() self.controller = volume_type_controller.VolumeTypeController(self.database_adapter) diff --git a/almanach/tests/unit/core/test_factory.py b/almanach/tests/unit/core/test_factory.py index f4c22a6..b38eac1 100644 --- a/almanach/tests/unit/core/test_factory.py +++ b/almanach/tests/unit/core/test_factory.py @@ -23,10 +23,10 @@ import mock from almanach.tests.unit import base -class FactoryTest(base.BaseTestCase): +class TestFactory(base.BaseTestCase): def setUp(self): - super(FactoryTest, self).setUp() + super(TestFactory, self).setUp() self.storage = mock.Mock() self.factory = factory.Factory(self.config, self.storage) diff --git a/almanach/tests/unit/storage/drivers/test_mongodb_driver.py b/almanach/tests/unit/storage/drivers/test_mongodb_driver.py index 202a686..efcfdd7 100644 --- a/almanach/tests/unit/storage/drivers/test_mongodb_driver.py +++ b/almanach/tests/unit/storage/drivers/test_mongodb_driver.py @@ -27,10 +27,10 @@ from almanach.tests.unit.builders.entity import volume from almanach.tests.unit.builders.entity import volume_type -class MongoDbDriverTest(base.BaseTestCase): +class TestMongoDbDriver(base.BaseTestCase): def setUp(self): - super(MongoDbDriverTest, self).setUp() + super(TestMongoDbDriver, self).setUp() mongo_connection = mongomock.Connection() self.db = mongo_connection['almanach'] self.adapter = mongodb_driver.MongoDbDriver(self.config, self.db) diff --git a/almanach/tests/unit/storage/test_storage_driver.py b/almanach/tests/unit/storage/test_storage_driver.py index 84c4c0d..48ffab4 100644 --- a/almanach/tests/unit/storage/test_storage_driver.py +++ b/almanach/tests/unit/storage/test_storage_driver.py @@ -19,10 +19,10 @@ from almanach.storage import storage_driver from almanach.tests.unit import base -class StorageDriverTest(base.BaseTestCase): +class TestStorageDriver(base.BaseTestCase): def setUp(self): - super(StorageDriverTest, self).setUp() + super(TestStorageDriver, self).setUp() self.storage_driver = storage_driver.StorageDriver(self.config) def test_get_default_database_adapter(self): diff --git a/almanach/tests/unit/validators/test_instance_validator.py b/almanach/tests/unit/validators/test_instance_validator.py index d30fbe2..0b47f10 100644 --- a/almanach/tests/unit/validators/test_instance_validator.py +++ b/almanach/tests/unit/validators/test_instance_validator.py @@ -23,7 +23,8 @@ from almanach.core import exception from almanach.validators.instance_validator import InstanceValidator -class InstanceValidatorTests(unittest.TestCase): +class TestInstanceValidator(unittest.TestCase): + def test_validate_update_with_invalid_attribute(self): instance_validator = InstanceValidator() payload = {"invalid attribute": ".."}