~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/jobs/tests/test_ingest.py

  • Committer: Tarmac
  • Author(s): Abel Deuring
  • Date: 2013-08-07 13:31:20 UTC
  • mfrom: (334.1.5 etags)
  • Revision ID: tarmac-20130807133120-euu4igaar08e89iy
[r=abentley][bug=][author=adeuring] Add an Etag header to the API response for charm details.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    slurp_files,
35
35
    update_branch,
36
36
    update_charm,
 
37
    update_hash,
37
38
    UpdateCharmJob,
38
39
    UpdateBundleJob,
39
40
    update_date_created,
591
592
        self.assertEqual(expected, log_messages)
592
593
        log_level = handler.buffer[0].levelname
593
594
        self.assertEqual('INFO', log_level)
 
595
 
 
596
 
 
597
class TestUpdateHash(TestCase):
 
598
 
 
599
    def test_update_hash(self):
 
600
        # update_hash() adds a hash to a charm.
 
601
        charm_data = factory.get_charm_json()
 
602
        self.assertFalse('hash' in charm_data)
 
603
        update_hash(charm_data)
 
604
        old_hash = charm_data['hash']
 
605
        # Changing any value of the charm changes the hash.
 
606
        charm_data['name'] = charm_data['name'] + 'changed'
 
607
        update_hash(charm_data)
 
608
        self.assertNotEqual(old_hash, charm_data['hash'])
 
609
 
 
610
    def test_hash_value_not_included_in_calculation(self):
 
611
        # The hash value itself is not included in a new calculation of the
 
612
        # hash.
 
613
        charm_data = factory.get_charm_json()
 
614
        update_hash(charm_data)
 
615
        old_hash = charm_data['hash']
 
616
        charm_data['hash'] = 'some other value'
 
617
        update_hash(charm_data)
 
618
        self.assertEqual(old_hash, charm_data['hash'])