~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/tests/test_models.py

[r=adeuring,abentley][bug=1199790][author=adeuring] Return dummy data for Charm.last_change and Charm.first_change, if a branch does not have any commits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
346
346
        charm_data['first_change'] = change
347
347
        charm = Charm(charm_data)
348
348
        self.assertIs(change, charm.first_change)
349
 
        # The default is None.
 
349
        # The default is some dummy data.
350
350
        charm = Charm({})
351
 
        self.assertIs(None, charm.first_change)
 
351
        expected = {
 
352
            'authors': [],
 
353
            'committer': '',
 
354
            'created': None,
 
355
            'message': '',
 
356
            'revno': 0,
 
357
        }
 
358
        self.assertEqual(expected, charm.first_change)
352
359
 
353
360
    def test_last_change(self):
354
361
        # The last_change property is a revision info dict.
357
364
        charm_data['last_change'] = change
358
365
        charm = Charm(charm_data)
359
366
        self.assertIs(change, charm.last_change)
360
 
        # The default is None.
 
367
        # The default is some dummy data.
361
368
        charm = Charm({})
362
 
        self.assertIs(None, charm.last_change)
 
369
        expected = {
 
370
            'authors': [],
 
371
            'committer': '',
 
372
            'created': None,
 
373
            'message': '',
 
374
            'revno': 0,
 
375
        }
 
376
        self.assertEqual(expected, charm.last_change)
363
377
 
364
378
    def test_revision(self):
365
379
        # The revision property is an int.