Browse Source

trivial: Reduce duplication in network policy tests

This commit reuses some existing tests from the SystemAdminTests module
for SystemMemberTests and SystemReaderTests, slightly reducing some
duplicated code.

Change-Id: I03d1b9060ad5d80ae85ddded57958c153accfbd1
changes/18/785518/1
Lance Bragstad 2 months ago
parent
commit
e96fcd0532
1 changed files with 1 additions and 53 deletions
  1. +1
    -53
      neutron/tests/unit/conf/policies/test_network.py

+ 1
- 53
neutron/tests/unit/conf/policies/test_network.py View File

@ -246,7 +246,7 @@ class SystemAdminTests(NetworkAPITestCase):
policy.enforce(self.context, 'delete_network', self.alt_target))
class SystemMemberTests(NetworkAPITestCase):
class SystemMemberTests(SystemAdminTests):
def setUp(self):
super(SystemMemberTests, self).setUp()
@ -347,58 +347,6 @@ class SystemMemberTests(NetworkAPITestCase):
self.context, 'create_network:provider:segmentation_id',
self.alt_target)
def test_get_network(self):
self.assertTrue(
policy.enforce(self.context, 'get_network', self.target))
self.assertTrue(
policy.enforce(self.context, 'get_network', self.alt_target))
def test_get_network_external(self):
self.assertTrue(
policy.enforce(self.context,
'get_network:router:external', self.target))
self.assertTrue(
policy.enforce(self.context,
'get_network:router:external', self.alt_target))
def test_get_network_segments(self):
self.assertTrue(
policy.enforce(self.context,
'get_network:segments', self.target))
self.assertTrue(
policy.enforce(self.context,
'get_network:segments', self.alt_target))
def test_get_network_provider_network_type(self):
self.assertTrue(
policy.enforce(self.context,
'get_network:provider:network_type',
self.target))
self.assertTrue(
policy.enforce(self.context,
'get_network:provider:network_type',
self.alt_target))
def test_get_network_provider_physical_network(self):
self.assertTrue(
policy.enforce(self.context,
'get_network:provider:physical_network',
self.target))
self.assertTrue(
policy.enforce(self.context,
'get_network:provider:physical_network',
self.alt_target))
def test_get_network_provider_segmentation_id(self):
self.assertTrue(
policy.enforce(self.context,
'get_network:provider:segmentation_id',
self.target))
self.assertTrue(
policy.enforce(self.context,
'get_network:provider:segmentation_id',
self.alt_target))
def test_update_network(self):
self.assertRaises(
base_policy.PolicyNotAuthorized,


Loading…
Cancel
Save