예제 #1
0
 def test_list_by_filters(self):
     dep1 = utils.create_test_deployable(self.context,
                                         id=1,
                                         uuid=uuidutils.generate_uuid(),
                                         name='mydep1')
     utils.create_test_deployable(self.context,
                                  id=2,
                                  uuid=uuidutils.generate_uuid(),
                                  name='mydep2')
     res = self.dbapi.deployable_get_by_filters(self.context,
                                                filters={"name": "mydep1"})
     self.assertEqual(1, len(res))
     self.assertEqual(dep1['name'], res[0]['name'])
예제 #2
0
 def test_update(self):
     created_dep = utils.create_test_deployable(self.context)
     bit_stream_id = '10efe63d-dfea-4a37-ad94-4116fba5011'
     queried_dep = self.dbapi.deployable_update(
         self.context, created_dep['uuid'],
         {'bit_stream_id': bit_stream_id})
     self.assertEqual(bit_stream_id, queried_dep['bit_stream_id'])
예제 #3
0
 def test_list(self):
     uuids = []
     for i in range(1, 4):
         dep = utils.create_test_deployable(self.context,
                                            id=i,
                                            uuid=uuidutils.generate_uuid())
         uuids.append(dep['uuid'])
     deps = self.dbapi.deployable_list(self.context)
     dep_uuids = [item.uuid for item in deps]
     self.assertEqual(sorted(uuids), sorted(dep_uuids))
예제 #4
0
 def test_list_filter_is_none(self):
     """The main test is filters=None. If filters=None,
     it will be initialized to {}, that will return all deployable
     same as the List Deployable API response.
     """
     dep1 = utils.create_test_deployable(self.context,
                                         id=1,
                                         uuid=uuidutils.generate_uuid())
     res = self.dbapi.deployable_get_by_filters(self.context, filters=None)
     self.assertEqual(1, len(res))
     self.assertEqual(dep1['uuid'], res[0]['uuid'])
예제 #5
0
 def test_delete(self):
     created_dep = utils.create_test_deployable(self.context)
     return_value = self.dbapi.deployable_delete(self.context,
                                                 created_dep['uuid'])
     self.assertIsNone(return_value)
예제 #6
0
 def test_get_by_rp_uuid(self):
     created_dep = utils.create_test_deployable(self.context)
     queried_dep = self.dbapi.deployable_get_by_rp_uuid(
         self.context, created_dep['rp_uuid'])
     self.assertEqual(created_dep['uuid'], queried_dep['uuid'])
예제 #7
0
 def test_create(self):
     kw = {'name': 'test_create_dep'}
     created_dep = utils.create_test_deployable(self.context, **kw)
     self.assertEqual(created_dep['name'], kw['name'])