Skip to content

Commit 038334f

Browse files
committed
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
1 parent 29b9945 commit 038334f

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

openstackclient/tests/network/v2/test_network.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ def setUp(self):
7272
self.api = self.app.client_manager.network.api
7373

7474

75-
class TestCreateNetwork(common.TestNetworkBase):
75+
class TestCreateNetworkIdentityV3(TestNetwork):
76+
77+
def setUp(self):
78+
super(TestCreateNetworkIdentityV3, self).setUp()
79+
7680
def test_create_no_options(self):
7781
arglist = [
7882
FAKE_NAME,
@@ -174,6 +178,12 @@ def test_create_other_options(self):
174178
})
175179
self.assertEqual(FILTERED, result)
176180

181+
182+
class TestCreateNetworkIdentityV2(TestNetwork):
183+
184+
def setUp(self):
185+
super(TestCreateNetworkIdentityV2, self).setUp()
186+
177187
def test_create_with_project_identityv2(self):
178188
arglist = [
179189
"--project", identity_fakes_v2.project_name,

0 commit comments

Comments
 (0)