Updated_at not being passed to db in image create

This results in fragile tests in which updated_at and
created_at are not equal

Fixes bug 1123515

Change-Id: Ibc29fef092d4d09473abb8818bea53658afcd5bf
This commit is contained in:
iccha-sethi 2013-02-13 20:57:01 +00:00
parent c21f8a4276
commit 75dd3fb001
2 changed files with 3 additions and 1 deletions

View File

@ -149,6 +149,9 @@ class ImageRepo(object):
def add(self, image):
image_values = self._format_image_to_db(image)
# the updated_at value is not set in the _format_image_to_db
# function since it is specific to image create
image_values['updated_at'] = image.updated_at
new_values = self.db_api.image_create(self.context, image_values)
self.db_api.image_tag_set_all(self.context,
image.image_id, image.tags)

View File

@ -169,7 +169,6 @@ class TestImageRepo(test_utils.BaseTestCase):
image = self.image_factory.new_image(name='added image')
self.assertEqual(image.updated_at, image.created_at)
self.image_repo.add(image)
self.assertTrue(image.updated_at > image.created_at)
retreived_image = self.image_repo.get(image.image_id)
self.assertEqual(retreived_image.name, 'added image')
self.assertEqual(retreived_image.updated_at, image.updated_at)