~juju-jitsu/charmworld/trunk

« back to all changes in this revision

Viewing changes to charmworld/tests/test_models.py

  • Committer: Benji York
  • Date: 2013-10-23 18:52:03 UTC
  • mfrom: (425.2.8 expose-bundle-changes)
  • Revision ID: benji.york@canonical.com-20131023185203-s2l2ev947imfnkm2
Add recent bzr changes to bundles.

R=bac
CC=
https://codereview.appspot.com/15100046

Show diffs side-by-side

added added

removed removed

Lines of Context:
1595
1595
        basket_id = "%s/%d" % (basket_name, basket_rev)
1596
1596
        _id = Bundle.construct_id(owner, basket_name, bundle_name, basket_rev)
1597
1597
        store_bundles(
1598
 
            self.db.bundles, parsed, 'bac', basket_id)
 
1598
            self.db.bundles, parsed, 'bac', basket_id, None, None, None)
1599
1599
        self.assertEqual(
1600
1600
            {
1601
1601
                '_id': _id,
1604
1604
                'name': bundle_name,
1605
1605
                'owner': owner,
1606
1606
                'data': parsed['wordpress-stage'],
 
1607
                'first_change': None,
 
1608
                'last_change': None,
 
1609
                'changes': None,
1607
1610
            },
1608
1611
            self.db.bundles.find_one(_id))
1609
1612
 
1638
1641
 
1639
1642
        with patch('charmworld.models.get_flattened_deployment',
1640
1643
                   get_flattened_deployment):
1641
 
            store_bundles(self.db.bundles, parsed, 'bac', 'wordpress-basket/5')
 
1644
            store_bundles(
 
1645
                self.db.bundles, parsed, 'bac', 'wordpress-basket/5', None,
 
1646
                None, None)
1642
1647
        self.assertItemsEqual(['wordpress-stage', 'wordpress-prod'], keys)
1643
1648
 
1644
1649
    def test_storing_a_bundle_includes_indexing_it(self):
1656
1661
        with patch(
1657
1662
                'charmworld.models.ElasticSearchClient',
1658
1663
                FauxElasticSearchClient):
1659
 
            store_bundles(self.db.bundles, {}, 'owner', 'wordpress-basket/5')
 
1664
            store_bundles(
 
1665
                self.db.bundles, {}, 'owner', 'wordpress-basket/5', None,
 
1666
                None, None)
1660
1667
 
1661
1668
        self.assertTrue(FauxElasticSearchClient.index_bundles_called)
1662
1669
 
2002
2009
class TestMakeBundleDoc(TestCase):
2003
2010
 
2004
2011
    def test_bundle_doc(self):
2005
 
        doc = make_bundle_doc({'a': 'b'}, 'foo', 'bar/9', 'baz')
 
2012
        doc = make_bundle_doc(
 
2013
            {'a': 'b'}, 'foo', 'bar/9', 'baz', None, None, None)
2006
2014
        self.assertEqual({
2007
2015
            'owner': 'foo',
2008
2016
            'basket_name': 'bar',
2010
2018
            'name': 'baz',
2011
2019
            'data': {'a': 'b'},
2012
2020
            '_id': '~foo/bar/9/baz',
 
2021
            'first_change': None,
 
2022
            'last_change': None,
 
2023
            'changes': None,
2013
2024
        }, doc)
2014
2025
 
2015
2026