def setUp(self):
        super(TestLibraryPolicyModel, self).setUp()

        services = api_base.setup_config()
        self.library_policy_model = services['api']['api-library-policy']
        self.node = services['node']
        self.engine = services['engine']

        # clear the library policies loaded on startup
        db_library_policies.delete_policies()

        self._add_test_policy()
    def test_delete_policies(self):
        db_library_policies.delete_policies()
        res = db_library_policies.get_policies()
        self.assertEqual(len(res), 0)

        db_library_policies.add_policy({
            'name':
            'policy1',
            'abbreviation':
            'abbr',
            'kind':
            'database',
            'description':
            'descrip',
            'rules': [{
                'rule': 'p(x) :- q(x)',
                'comment': 'test comment',
                'name': 'testname'
            }]
        })

        db_library_policies.add_policy({
            'name':
            'policy2',
            'abbreviation':
            'abbr',
            'kind':
            'database',
            'description':
            'descrip',
            'rules': [{
                'rule': 'p(x) :- q(x)',
                'comment': 'test comment',
                'name': 'testname'
            }]
        })

        db_library_policies.delete_policies()
        res = db_library_policies.get_policies()
        self.assertEqual(len(res), 0)
 def setUp(self):
     super(TestDbLibraryPolicies, self).setUp()
     db_library_policies.delete_policies()  # delete preloaded policies
Example #4
0
    def setUp(self):
        """Setup tests that use multiple mock neutron instances."""
        super(TestCongress, self).setUp()

        # clear the library policies loaded on startup
        db_library_policies.delete_policies()
Example #5
0
 def delete_all_policies(self):
     # Note(thread-safety): blocking call
     db_library_policies.delete_policies()
Example #6
0
    def setUp(self):
        """Setup tests that use multiple mock neutron instances."""
        super(TestCongress, self).setUp()

        # clear the library policies loaded on startup
        db_library_policies.delete_policies()