Refactor TestCreateNetwork: Split TestCreateNetwork into two classes for identity v2 and v3

In TestCreateNetwork, both Identity v2 and v3 clients are tested. As a result, we should
initialize the identity client again and again in each test function.

To reduce redundant code, this patch split TestCreateNetwork to TestCreateNetworkIdentityV2 and V3.
And then initialize the identity client only once in each of them.

Change-Id: I349fe7f827524beb541efe7dd9460c534254b80c
Implements: blueprint osc-network-unit-test-refactor
Related-to: blueprint neutron-client
This commit is contained in:
Tang Chen
2015-12-01 19:47:19 +08:00
parent 29b9945677
commit 038334ff98

View File

@@ -72,7 +72,11 @@ class TestNetwork(network_fakes.TestNetworkV2):
self.api = self.app.client_manager.network.api
class TestCreateNetwork(common.TestNetworkBase):
class TestCreateNetworkIdentityV3(TestNetwork):
def setUp(self):
super(TestCreateNetworkIdentityV3, self).setUp()
def test_create_no_options(self):
arglist = [
FAKE_NAME,
@@ -174,6 +178,12 @@ class TestCreateNetwork(common.TestNetworkBase):
})
self.assertEqual(FILTERED, result)
class TestCreateNetworkIdentityV2(TestNetwork):
def setUp(self):
super(TestCreateNetworkIdentityV2, self).setUp()
def test_create_with_project_identityv2(self):
arglist = [
"--project", identity_fakes_v2.project_name,