예제 #1
0
 def test_hash_name_update(self):
     hasher = HasherDataModel(self.hasher_id,
                              hash_name=self.name,
                              mother_kennel=self.kennel)
     hasher.save()
     hasher.add_update_action('hash_name', 'set', 'Different Hash Name')
     hasher.update()
     self.assertEqual(hasher.searchable_hash_name,
                      'differenthashname'.lower())
예제 #2
0
 def test_mother_kennel_update(self):
     kennel2 = {
         'kennel_id': 'test_kennel_2',
         'name': 'Test Kennel 2',
         'acronym': 'TK2H3'
     }
     hasher = HasherDataModel(self.hasher_id,
                              hash_name=self.name,
                              mother_kennel=self.kennel)
     hasher.save()
     hasher.add_update_action('mother_kennel', 'set', kennel2)
     hasher.update()
     self.assertEqual(hasher.searchable_mother_kennel_name, 'testkennel2')
예제 #3
0
 def test_timestamps_on_update(self):
     new_kennel_name = 'New Kennel 1'
     start_time = datetime.now(timezone.utc)
     with freeze_time(start_time):
         hasher = HasherDataModel(self.hasher_id,
                                  mother_kennel=self.kennel,
                                  hash_name=self.name,
                                  user=self.user)
         hasher.save()
     mid_time = datetime.now(timezone.utc)
     with freeze_time(mid_time):
         hasher.add_update_action('mother_kennel.name', 'set',
                                  new_kennel_name)
         hasher.update()
     self.assertEqual(hasher.modified_at, mid_time)
     self.assertEqual(hasher.created_at, start_time)
     self.assertEqual(hasher.mother_kennel.name, new_kennel_name)