Browse Source

Remove redundant code about fake_policy

The code is copied from ironic. Ironic has no policy in Juno
, so it need the code to test. But it is not needed in magnum.

Change-Id: Ib066d953993b92c7c96d661cfcb7f2d3ef888659
Closes-Bug: #1482023
changes/45/209745/4
Hua Wang 7 years ago
parent
commit
ebc26f02c4
  1. 15
      magnum/tests/fake_policy.py
  2. 4
      magnum/tests/policy_fixture.py

15
magnum/tests/fake_policy.py

@ -70,18 +70,3 @@ policy_data = """
"container:update": ""
}
"""
policy_data_compat_juno = """
{
}
"""
def get_policy_data(compat):
if not compat:
return policy_data
elif compat == 'juno':
return policy_data_compat_juno
else:
raise Exception('Policy data for %s not available' % compat)

4
magnum/tests/policy_fixture.py

@ -26,15 +26,13 @@ CONF = cfg.CONF
class PolicyFixture(fixtures.Fixture):
def __init__(self, compat=None):
self.compat = compat
def _setUp(self):
self.policy_dir = self.useFixture(fixtures.TempDir())
self.policy_file_name = os.path.join(self.policy_dir.path,
'policy.json')
with open(self.policy_file_name, 'w') as policy_file:
policy_file.write(fake_policy.get_policy_data(self.compat))
policy_file.write(fake_policy.policy_data)
policy_opts.set_defaults(CONF)
CONF.set_override('policy_file', self.policy_file_name, 'oslo_policy')
magnum_policy._ENFORCER = None

Loading…
Cancel
Save