def test_get_all_descriptors(self):
     resource = {'object_id': 'fake-object-id-2',
                 'resource_type': 'fake-resource-type',
                 'resource_id': 'fake-resource-id-2',
                 'resource_descriptor': 'com.vyatta.vm.2'}
     self.obj = dict(api.binding_add(self.context, resource))
     descriptors_in_db = api.binding_get_descriptors(
         self.context, 'fake-resource-type')
     descriptors = ['com.vyatta.vm', 'com.vyatta.vm.2']
     self.assertListEqual(descriptors, descriptors_in_db)
 def setUp(self):
     super(BindingDBTestCase, self).setUp()
     db_api.configure_db()
     self.addCleanup(db_api.clear_db)
     self.context = context.get_admin_context()
     resource = {'object_id': 'fake-object-id',
                 'resource_type': 'fake-resource-type',
                 'resource_id': 'fake-resource-id',
                 'resource_descriptor': 'com.vyatta.vm'}
     self.obj = dict(api.binding_add(self.context, resource))
 def bind_object(self, context, object_id, resource):
     resource['object_id'] = object_id
     resource.update(dict(db_api.binding_add(context, resource)))
 def test_add_dublicate_after_delete(self):
     api.binding_delete(self.context, self.obj['object_id'])
     obj = dict(api.binding_add(self.context, self.obj))
     self.assertEqual(self.obj['object_id'], obj['object_id'])