From e0d0bb930521097000d6a415360a051b0428aa80 Mon Sep 17 00:00:00 2001 From: Rakesh H S Date: Tue, 7 Jul 2015 23:15:16 +0530 Subject: [PATCH] Move all api tests to /tests/api Move all api tests to /tests/api/*. Change-Id: Ib5a61a61a19827aad8b2d5fb5d4e2d19450da72a --- heat/tests/api/__init__.py | 0 heat/tests/api/aws/__init__.py | 0 heat/tests/{ => api/aws}/test_api_aws.py | 0 heat/tests/{ => api/aws}/test_api_ec2token.py | 0 heat/tests/api/cfn/__init__.py | 0 heat/tests/{ => api/cfn}/test_api_cfn_v1.py | 10 ++-- heat/tests/api/cloudwatch/__init__.py | 0 .../cloudwatch}/test_api_cloudwatch.py | 50 ++++++++++--------- heat/tests/api/middleware/__init__.py | 0 .../middleware}/test_ssl_middleware.py | 0 .../test_version_negotiation_middleware.py | 0 heat/tests/api/openstack/__init__.py | 0 .../openstack}/test_api_openstack_v1.py | 0 .../openstack}/test_api_openstack_v1_util.py | 0 ..._openstack_v1_views_stacks_view_builder.py | 0 ...est_api_openstack_v1_views_views_common.py | 0 heat/tests/{ => api}/test_wsgi.py | 0 17 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 heat/tests/api/__init__.py create mode 100644 heat/tests/api/aws/__init__.py rename heat/tests/{ => api/aws}/test_api_aws.py (100%) rename heat/tests/{ => api/aws}/test_api_ec2token.py (100%) create mode 100644 heat/tests/api/cfn/__init__.py rename heat/tests/{ => api/cfn}/test_api_cfn_v1.py (99%) create mode 100644 heat/tests/api/cloudwatch/__init__.py rename heat/tests/{ => api/cloudwatch}/test_api_cloudwatch.py (98%) create mode 100644 heat/tests/api/middleware/__init__.py rename heat/tests/{ => api/middleware}/test_ssl_middleware.py (100%) rename heat/tests/{ => api/middleware}/test_version_negotiation_middleware.py (100%) create mode 100644 heat/tests/api/openstack/__init__.py rename heat/tests/{ => api/openstack}/test_api_openstack_v1.py (100%) rename heat/tests/{ => api/openstack}/test_api_openstack_v1_util.py (100%) rename heat/tests/{ => api/openstack}/test_api_openstack_v1_views_stacks_view_builder.py (100%) rename heat/tests/{ => api/openstack}/test_api_openstack_v1_views_views_common.py (100%) rename heat/tests/{ => api}/test_wsgi.py (100%) diff --git a/heat/tests/api/__init__.py b/heat/tests/api/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/tests/api/aws/__init__.py b/heat/tests/api/aws/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/tests/test_api_aws.py b/heat/tests/api/aws/test_api_aws.py similarity index 100% rename from heat/tests/test_api_aws.py rename to heat/tests/api/aws/test_api_aws.py diff --git a/heat/tests/test_api_ec2token.py b/heat/tests/api/aws/test_api_ec2token.py similarity index 100% rename from heat/tests/test_api_ec2token.py rename to heat/tests/api/aws/test_api_ec2token.py diff --git a/heat/tests/api/cfn/__init__.py b/heat/tests/api/cfn/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/tests/test_api_cfn_v1.py b/heat/tests/api/cfn/test_api_cfn_v1.py similarity index 99% rename from heat/tests/test_api_cfn_v1.py rename to heat/tests/api/cfn/test_api_cfn_v1.py index d84d27f63a..cfb68ccf37 100644 --- a/heat/tests/test_api_cfn_v1.py +++ b/heat/tests/api/cfn/test_api_cfn_v1.py @@ -29,7 +29,7 @@ from heat.rpc import client as rpc_client from heat.tests import common from heat.tests import utils -policy_path = os.path.dirname(os.path.realpath(__file__)) + "/policy/" +policy_path = os.path.dirname(os.path.realpath(__file__)) + "/../../policy/" class CfnStackControllerTest(common.HeatTestCase): @@ -41,12 +41,12 @@ class CfnStackControllerTest(common.HeatTestCase): def setUp(self): super(CfnStackControllerTest, self).setUp() - opts = [ + self.opts = [ cfg.StrOpt('config_dir', default=policy_path), cfg.StrOpt('config_file', default='foo'), cfg.StrOpt('project', default='heat'), ] - cfg.CONF.register_opts(opts) + cfg.CONF.register_opts(self.opts) cfg.CONF.set_default('host', 'host') self.topic = rpc_api.ENGINE_TOPIC self.api_version = '1.0' @@ -62,6 +62,10 @@ class CfnStackControllerTest(common.HeatTestCase): 'deny_stack_user.json') self.addCleanup(self.m.VerifyAll) + def tearDown(self): + super(CfnStackControllerTest, self).tearDown() + cfg.CONF.unregister_opts(self.opts) + def _dummy_GET_request(self, params=None): # Mangle the params dict into a query string params = params or {} diff --git a/heat/tests/api/cloudwatch/__init__.py b/heat/tests/api/cloudwatch/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/tests/test_api_cloudwatch.py b/heat/tests/api/cloudwatch/test_api_cloudwatch.py similarity index 98% rename from heat/tests/test_api_cloudwatch.py rename to heat/tests/api/cloudwatch/test_api_cloudwatch.py index f7e7988cc9..8cc85dab71 100644 --- a/heat/tests/test_api_cloudwatch.py +++ b/heat/tests/api/cloudwatch/test_api_cloudwatch.py @@ -32,6 +32,33 @@ class WatchControllerTest(common.HeatTestCase): the endpoint processing API requests after they are routed ''' + def setUp(self): + super(WatchControllerTest, self).setUp() + self.path = os.path.dirname(os.path.realpath(__file__)) + self.policy_path = self.path + "/../../policy/" + self.opts = [ + cfg.StrOpt('config_dir', default=self.policy_path), + cfg.StrOpt('config_file', default='foo'), + cfg.StrOpt('project', default='heat'), + ] + cfg.CONF.register_opts(self.opts) + cfg.CONF.set_default('host', 'host') + self.topic = rpc_api.ENGINE_TOPIC + self.api_version = '1.0' + + # Create WSGI controller instance + class DummyConfig(object): + bind_port = 8003 + cfgopts = DummyConfig() + self.controller = watches.WatchController(options=cfgopts) + self.controller.policy.enforcer.policy_path = (self.policy_path + + 'deny_stack_user.json') + self.addCleanup(self.m.VerifyAll) + + def tearDown(self): + super(WatchControllerTest, self).tearDown() + cfg.CONF.unregister_opts(self.opts) + def _dummy_GET_request(self, params=None): # Mangle the params dict into a query string params = params or {} @@ -488,26 +515,3 @@ class WatchControllerTest(common.HeatTestCase): # should raise HeatInvalidParameterValueError result = self.controller.set_alarm_state(dummy_req) self.assertIsInstance(result, exception.HeatInvalidParameterValueError) - - def setUp(self): - super(WatchControllerTest, self).setUp() - self.path = os.path.dirname(os.path.realpath(__file__)) - self.policy_path = self.path + "/policy/" - opts = [ - cfg.StrOpt('config_dir', default=self.policy_path), - cfg.StrOpt('config_file', default='foo'), - cfg.StrOpt('project', default='heat'), - ] - cfg.CONF.register_opts(opts) - cfg.CONF.set_default('host', 'host') - self.topic = rpc_api.ENGINE_TOPIC - self.api_version = '1.0' - - # Create WSGI controller instance - class DummyConfig(object): - bind_port = 8003 - cfgopts = DummyConfig() - self.controller = watches.WatchController(options=cfgopts) - self.controller.policy.enforcer.policy_path = (self.policy_path + - 'deny_stack_user.json') - self.addCleanup(self.m.VerifyAll) diff --git a/heat/tests/api/middleware/__init__.py b/heat/tests/api/middleware/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/tests/test_ssl_middleware.py b/heat/tests/api/middleware/test_ssl_middleware.py similarity index 100% rename from heat/tests/test_ssl_middleware.py rename to heat/tests/api/middleware/test_ssl_middleware.py diff --git a/heat/tests/test_version_negotiation_middleware.py b/heat/tests/api/middleware/test_version_negotiation_middleware.py similarity index 100% rename from heat/tests/test_version_negotiation_middleware.py rename to heat/tests/api/middleware/test_version_negotiation_middleware.py diff --git a/heat/tests/api/openstack/__init__.py b/heat/tests/api/openstack/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/tests/test_api_openstack_v1.py b/heat/tests/api/openstack/test_api_openstack_v1.py similarity index 100% rename from heat/tests/test_api_openstack_v1.py rename to heat/tests/api/openstack/test_api_openstack_v1.py diff --git a/heat/tests/test_api_openstack_v1_util.py b/heat/tests/api/openstack/test_api_openstack_v1_util.py similarity index 100% rename from heat/tests/test_api_openstack_v1_util.py rename to heat/tests/api/openstack/test_api_openstack_v1_util.py diff --git a/heat/tests/test_api_openstack_v1_views_stacks_view_builder.py b/heat/tests/api/openstack/test_api_openstack_v1_views_stacks_view_builder.py similarity index 100% rename from heat/tests/test_api_openstack_v1_views_stacks_view_builder.py rename to heat/tests/api/openstack/test_api_openstack_v1_views_stacks_view_builder.py diff --git a/heat/tests/test_api_openstack_v1_views_views_common.py b/heat/tests/api/openstack/test_api_openstack_v1_views_views_common.py similarity index 100% rename from heat/tests/test_api_openstack_v1_views_views_common.py rename to heat/tests/api/openstack/test_api_openstack_v1_views_views_common.py diff --git a/heat/tests/test_wsgi.py b/heat/tests/api/test_wsgi.py similarity index 100% rename from heat/tests/test_wsgi.py rename to heat/tests/api/test_wsgi.py