Skip to content

Commit

Permalink
Populate the News ML creditline field based on the "source name" of t…
Browse files Browse the repository at this point in the history
…he ingest provider [SDBELGA-672] (#398)

* if item is ingested then we map item.source to creditline

* Update testcases
  • Loading branch information
devketanpro authored Sep 14, 2022
1 parent 6a884cc commit 9397671
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion server/belga/publish/belga_newsml_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ def _format_newslines(self, newscomponent_2_level, item):
SubElement(newslines, "CreditLine").text = subject.get("name")
break
else:
if item.get("source"):
if item.get("source") and item.get("ingest_provider"):
SubElement(newslines, "CreditLine").text = (
item["source"]
.replace(
Expand Down
2 changes: 1 addition & 1 deletion server/tests/publish/belga_newsml_1_2_picture_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def test_picture(self):
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Superdesk"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down
18 changes: 9 additions & 9 deletions server/tests/publish/belga_newsml_1_2_text_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class BelgaNewsML12FormatterTextTest(TestCase):
"original_creator": "5d385f31fe985ec67a0ca583",
"unique_id": 43,
"unique_name": "#43",
"state": "ingested",
"state": "in_progress",
"source": "Belga",
"priority": 6,
"urgency": 4,
Expand Down Expand Up @@ -1579,7 +1579,7 @@ def test_uploaded_picture_in_editor(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Superdesk"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -1705,7 +1705,7 @@ def test_belga_picture_in_editor(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "ZUMAPRESS"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -1808,7 +1808,7 @@ def test_uploaded_picture_related_images(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Superdesk"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -1972,7 +1972,7 @@ def test_belga_coverages(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "ITARTASS"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -2029,7 +2029,7 @@ def test_belga_coverage_custom_field(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "AFP"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -2083,7 +2083,7 @@ def test_audio_in_editor_and_related(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Superdesk"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -2134,7 +2134,7 @@ def test_video_in_editor_and_related(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Superdesk"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down Expand Up @@ -2235,7 +2235,7 @@ def test_related_article_internal(self):

# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Belga"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion server/tests/publish/belga_newsml_1_2_video_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def test_video(self):
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> CreditLine
self.assertEqual(
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "Superdesk"
newscomponent_2_level.xpath("NewsLines/CreditLine")[0].text, "BELGA"
)
# NewsML -> NewsItem -> NewsComponent -> NewsComponent -> NewsLines -> HeadLine
self.assertEqual(
Expand Down

0 comments on commit 9397671

Please sign in to comment.