From 038334ff986e76498ca4e02aafe43bb6e1891b11 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Tue, 1 Dec 2015 19:47:19 +0800 Subject: 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 --- openstackclient/tests/network/v2/test_network.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'openstackclient') diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py index 9a85826e..510e06b9 100644 --- a/openstackclient/tests/network/v2/test_network.py +++ b/openstackclient/tests/network/v2/test_network.py @@ -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, -- cgit v1.2.1