示例#1
0
 def _test_set_rules_with_deprecated_policy(self, input_rules, expected_rules):
     policy._set_rules(json.dumps(input_rules))
     # verify deprecated policy has been removed
     for pol in input_rules.keys():
         self.assertNotIn(pol, common_policy._rules)
     # verify deprecated policy was correctly translated. Iterate
     # over items for compatibility with unittest2 in python 2.6
     for rule in expected_rules:
         self.assertIn(rule, common_policy._rules)
         self.assertEqual(str(common_policy._rules[rule]), expected_rules[rule])
示例#2
0
 def _test_set_rules_with_deprecated_policy(self, input_rules,
                                            expected_rules):
     policy._set_rules(json.dumps(input_rules))
     # verify deprecated policy has been removed
     for pol in input_rules.keys():
         self.assertNotIn(pol, common_policy._rules)
     # verify deprecated policy was correctly translated. Iterate
     # over items for compatibility with unittest2 in python 2.6
     for rule in expected_rules:
         self.assertIn(rule, common_policy._rules)
         self.assertEqual(expected_rules[rule],
                          str(common_policy._rules[rule]))