1
1
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
7
from charmworld.models import (
11
15
from charmworld.search import (
272
276
new_mapping = self.index_client.get_mapping()
273
277
self.assertNotIn(
274
278
'files', new_mapping['charm']['properties']['data']['properties'])
280
class TestMigration018(MigrationTestBase):
283
super(TestMigration018, self).setUp()
284
self.use_index_client()
285
self.store_some_bundles()
287
def store_some_bundles(self):
288
deployer_config = textwrap.dedent("""\
293
charm: cs:precise/wordpress
299
parsed = yaml.safe_load(deployer_config)
301
bundle_name = 'wordpress-stage'
302
basket_id = 'wordpress-basket/5'
303
self.search_id = Bundle.construct_search_id(
304
owner, basket_id, bundle_name)
305
store_bundles(self.db.bundles, parsed, owner, basket_id,
306
index_client=self.index_client)
308
def test_bundles_are_removed_from_elastic_search(self):
309
assert self.index_client.get(self.search_id, BUNDLE), (
310
'the test bundle is missing')
311
self.versions.run_migration(
312
self.db, self.index_client, '018_delete_all_bundles.py')
313
self.assertIsNone(self.index_client.get(self.search_id, BUNDLE))
315
def test_bundles_are_removed_from_mongo(self):
316
assert self.index_client.get(self.search_id, BUNDLE), (
317
'the test bundle is missing')
318
self.versions.run_migration(
319
self.db, self.index_client, '018_delete_all_bundles.py')
320
self.assertIsNone(self.db.bundles.find_one({}))