summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2015-12-01 19:47:19 +0800
committerTang Chen <tangchen@cn.fujitsu.com>2015-12-05 10:52:05 +0800
commit038334ff986e76498ca4e02aafe43bb6e1891b11 (patch)
tree0869b7d4797abe8025cd603b58ba4255b55b52ce
parent29b994567787a47048f1a27a55efb88d68645490 (diff)
downloadpython-openstackclient-038334ff986e76498ca4e02aafe43bb6e1891b11.tar.gz
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
-rw-r--r--openstackclient/tests/network/v2/test_network.py12
1 files changed, 11 insertions, 1 deletions
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,