~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/tests/test_models.py

  • Committer: Curtis Hovey
  • Date: 2013-08-20 22:05:56 UTC
  • mfrom: (358 charmworld)
  • mto: This revision was merged to the branch mainline in revision 359.
  • Revision ID: curtis@canonical.com-20130820220556-zhm7woolfb0hs81x
Merged tip.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1420
1420
            self.assertEqual(foo, bar)
1421
1421
 
1422
1422
    def test_sync_index_script(self):
1423
 
        factory.makeCharm(self.db)[0]
 
1423
        factory.makeCharm(self.db, owner='b')[0]
1424
1424
        # Create a charm which is index-incompatible with the previous one.
1425
 
        factory.makeCharm(self.db,
1426
 
                          maintainer={'first': 'J', 'last': 'Random'})[0]
 
1425
        factory.makeCharm(self.db, owner='a',
 
1426
                          description={'text': 'whatever'})[0]
1427
1427
        handler = self.get_handler('sync-index')
1428
1428
        with patch('charmworld.models.configure_logging'):
1429
1429
            with patch('charmworld.models.get_ini', lambda: INI):
1438
1438
        source = CharmSource.from_request(self)
1439
1439
        source.save({
1440
1440
            '_id': 'a',
1441
 
            'b': {},
1442
1441
            'owner': 'foo',
1443
1442
            'series': 'bar',
1444
1443
            'name': 'baz',
 
1444
            'description': 'whatever',
1445
1445
        })
1446
1446
        with self.assertRaises(ElasticHttpError):
1447
1447
            source.save({
1448
1448
                '_id': 'a',
1449
 
                'b': 'c',
1450
1449
                'owner': 'foo',
1451
1450
                'series': 'bar',
1452
1451
                'name': 'baz',
 
1452
                # A dictionary as the value conflicts with the mapping.
 
1453
                'description': {'text': 'whatever'},
1453
1454
            })
1454
1455
        self.assertIs(None, self.index_client.get('a'))
1455
1456