Added a test triggering a bug in the current shelf.py.
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 13 Jun 2005 19:40:50 +0000 (19:40 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 13 Jun 2005 19:40:50 +0000 (19:40 +0000)
src/test/shelftests.py

index 9befb28..29d085a 100755 (executable)
@@ -821,6 +821,14 @@ class TestImage(TestShelfFixture):
         assert image.getPrimaryVersion() == imageversion
         imageversion2.makePrimary()
         assert image.getPrimaryVersion() == imageversion2
+
+        newImage = self.shelf.createImage()
+        lastImageVersion = list(image.getImageVersions())[-1]
+        lastImageVersion.setImage(newImage)
+        assert image.getPrimaryVersion() != lastImageVersion
+        assert newImage.getPrimaryVersion() == lastImageVersion
+        lastImageVersion.setImage(image)
+
         self.shelf.deleteImageVersion(imageversion2.getId())
         assert image.getPrimaryVersion() == imageversion
         self.shelf.deleteImageVersion(imageversion.getId())
@@ -838,8 +846,8 @@ class TestImageVersion(TestShelfFixture):
         imageversion.setType(ImageVersionType.Original)
         assert imageversion.getType() == ImageVersionType.Original
 
-    # ImageVersion.makePrimary tested in TestImage.test_getPrimaryversion.
-    # ImageVersion.setImage tested in TestImage.test_getPrimaryversion.
+    # ImageVersion.makePrimary tested in TestImage.test_getPrimaryVersion.
+    # ImageVersion.setImage tested in TestImage.test_getPrimaryVersion.
     # ImageVersion.setType tested in TestImageVersion.test_getType.
     # ImageVersion.setComment tested in TestImageVersion.test_getComment.