Просмотр исходного кода

change image property name to featured_image

Khue Vu лет назад: 10
Родитель
Сommit
c15a9dc250

+ 1 - 1
representative_image/representative_image.py

@@ -25,7 +25,7 @@ def images_extraction(instance):
                 representativeImage = imageTag['src']
         
         # Set the attribute to content instance
-        instance.repImage = representativeImage
+        instance.featured_image = representativeImage
 
 def register():
     signals.content_object_init.connect(images_extraction)

+ 2 - 2
representative_image/test_representative_image.py

@@ -29,7 +29,7 @@ class TestRepresentativeImage(unittest.TestCase):
         }
 
         article = Article(**args)
-        self.assertEqual(article.repImage, TEST_CONTENT_IMAGE_URL)
+        self.assertEqual(article.featured_image, TEST_CONTENT_IMAGE_URL)
 
     def test_extract_image_from_summary(self):
         args = {
@@ -40,7 +40,7 @@ class TestRepresentativeImage(unittest.TestCase):
         }
 
         article = Article(**args)
-        self.assertEqual(article.repImage, TEST_SUMMARY_IMAGE_URL)
+        self.assertEqual(article.featured_image, TEST_SUMMARY_IMAGE_URL)
         self.assertEqual(article.summary, TEST_SUMMARY_WITHOUTIMAGE)
 
 if __name__ == '__main__':