def test_get_all_with_all_api_flavors(self): db_flavors = db_api.flavor_get_all(self.context) for flavor in db_flavors: db_api.flavor_destroy(self.context, flavor['name']) flavor = ForcedFlavor(context=self.context, **fake_api_flavor) flavor.create() self._test_get_all(1)
def test_get_all_from_db(self): db_flavors = [ _TestFlavor._create_api_flavor(self.context), _TestFlavor._create_api_flavor(self.context, 'm1.bar'), ] db_flavors.extend(db_api.flavor_get_all(self.context)) flavors = objects.FlavorList.get_all(self.context) self.assertEqual(len(db_flavors), len(flavors))
def test_get_all_with_marker_in_main(self): db_flavors = db_api.flavor_get_all(self.context) db_flavor_ids = [x['flavorid'] for x in db_flavors] flavor = ForcedFlavor(context=self.context, **fake_api_flavor) flavor.create() fake_flavor2 = dict(fake_api_flavor, name='m1.zoo', flavorid='m1.zoo') flavor = ForcedFlavor(context=self.context, **fake_flavor2) flavor.create() result = self._test_get_all(2, marker='3', limit=3) result_flavorids = [x.flavorid for x in result] self.assertEqual(db_flavor_ids[3:], result_flavorids)
def _delete_main_flavors(self): flavors = db_api.flavor_get_all(self.context) for flavor in flavors: db_api.flavor_destroy(self.context, flavor['name'])
def test_get_all_with_some_api_flavors(self): expect_len = len(db_api.flavor_get_all(self.context)) flavor = ForcedFlavor(context=self.context, **fake_api_flavor) flavor.create() self._test_get_all(expect_len + 1)
def test_get_all(self): expect_len = len(db_api.flavor_get_all(self.context)) self._test_get_all(expect_len)