#350 The Lightblue.get_images_by_nvrs expects list as input, but we passed it str.
Merged 3 months ago by jkaluza. Opened 3 months ago by jkaluza.
jkaluza/freshmaker spec-fix  into  master

file modified
+3 -3

@@ -501,9 +501,9 @@ 

      def resolve_published(self, lb_instance):

          # Get the published version of this image to find out if the image

          # was actually published.

-         image = lb_instance.get_images_by_nvrs(

-             self["brew"]["build"], published=True)

-         if image:

+         images = lb_instance.get_images_by_nvrs(

+             [self["brew"]["build"]], published=True)

+         if images:

              self["published"] = True

          else:

              self["published"] = False

file modified
+28

@@ -522,6 +522,34 @@ 

          image.resolve_content_sets(lb)

          self.assertEqual(image["content_sets"], [])

  

+     def test_resolve_published(self):

+         image = ContainerImage.create({

+             '_id': '1233829',

+             'brew': {

+                 'build': 'package-name-1-4-12.10',

+             },

+         })

+ 

+         lb = Mock()

+         lb.get_images_by_nvrs.return_value = [image]

+         image.resolve_published(lb)

+         self.assertEqual(image["published"], True)

+         lb.get_images_by_nvrs.assert_called_once_with(

+             ["package-name-1-4-12.10"], published=True)

+ 

+     def test_resolve_published_unpublished(self):

+         image = ContainerImage.create({

+             '_id': '1233829',

+             'brew': {

+                 'build': 'package-name-1-4-12.10',

+             },

+         })

+ 

+         lb = Mock()

+         lb.get_images_by_nvrs.return_value = []

+         image.resolve_published(lb)

+         self.assertEqual(image["published"], False)

+ 

  

  class TestContainerRepository(helpers.FreshmakerTestCase):

  

This leads to an error that all ContainerImage objects were marked as unpublished
and extra ODCS compose was requested for them even if not needed.

Commit a2df3ee fixes this pull-request

Pull-Request has been merged by jkaluza

3 months ago

Pull-Request has been merged by jkaluza

3 months ago