~adeuring/charmworld/spurious-failures

« back to all changes in this revision

Viewing changes to charmworld/tests/test_search.py

  • Committer: Abel Deuring
  • Date: 2013-08-29 12:48:45 UTC
  • mfrom: (369.1.3 charmworld)
  • Revision ID: adeuring@gmx.net-20130829124845-cme0wj27ror222x3
trunk merged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
759
759
            ['bundle', CHARM],
760
760
            sorted(mapping['temp_index'].keys()))
761
761
 
 
762
    def test_get_items(self):
 
763
        # The method returns the typed documents that match the typed_ids.
 
764
        charm_data = {'name': 'charm', 'owner': 'owner1', 'series': 'series'}
 
765
        self.index_client.index_charm(charm_data)
 
766
        bundle_data = {
 
767
            'name': 'bundle', 'owner': 'owner2', 'basket_name': 'basket'}
 
768
        self.index_client.index_bundle(bundle_data)
 
769
        typed_ids = [
 
770
            {'_id': '~owner1/series/charm', '_type': CHARM},
 
771
            {'_id': '~owner2/basket/bundle', '_type': BUNDLE}
 
772
        ]
 
773
        docs = self.index_client.get_items(typed_ids)
 
774
        expected = [
 
775
            {'data': charm_data, 'doctype': CHARM},
 
776
            {'data': bundle_data, 'doctype': BUNDLE}
 
777
        ]
 
778
        self.assertEqual(expected, docs)
 
779
 
 
780
    def test_get_items_with_empty_list(self):
 
781
        # When test_ids is an empty list, the list of docs is also empty.
 
782
        self.assertEqual([], self.index_client.get_items([]))
 
783
 
762
784
    def test_related_charms(self):
763
785
        client = self.index_client
764
786
        charm = factory.get_charm_json(provides={'abc': {'interface': 'def'}})