Skip to content

Commit

Permalink
feature/pdct-1554-map-gcf-source-url-to-document-pdf-not-url (#25)
Browse files Browse the repository at this point in the history
fix: document source url points to pdf

- we were incorrectly pointing to the permalink, not the url with that
  housed the pdf

Co-authored-by: Osneil Drakes <[email protected]>
  • Loading branch information
odrakes-cpr and Osneil Drakes authored Oct 3, 2024
1 parent eeb8921 commit 933b4fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gcf_data_mapper/enums/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class RequiredDocumentColumns(Enum):
TITLE = "Title"
TYPE = "Type"
ID = "ID (Unique ID from our CMS for the document)"
SOURCE_URL = "Document page permalink"
SOURCE_URL = "Main file (English)"


class TranslatedDocumentColumns(Enum):
Expand Down
7 changes: 7 additions & 0 deletions tests/unit_tests/parsers/document/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ID (Unique ID from our CMS for the document)": "doc123",
"Type": "type123",
"Title": "title123",
"Main file (English)": "link123.pdf",
"Document page permalink": "link123",
"Translated files": "http://example.com",
"Translated titles": None,
Expand All @@ -20,6 +21,7 @@
"ID (Unique ID from our CMS for the document)": "doc123",
"Type": "type123",
"Title": "title123",
"Main file (English)": "link123.pdf",
"Document page permalink": "link123",
"Translated titles": None,
},
Expand All @@ -38,6 +40,7 @@ def mock_valid_doc_row_with_one_translation():
"ID (Unique ID from our CMS for the document)": "doc123",
"Type": "type123",
"Title": "title123",
"Main file (English)": "link123.pdf",
"Document page permalink": "link123",
"Translated files": "http://example.com",
"Translated titles": "title123",
Expand All @@ -54,6 +57,7 @@ def mock_valid_doc_row_with_many_translations():
"ID (Unique ID from our CMS for the document)": "doc123",
"Type": "type123",
"Title": "title123",
"Main file (English)": "link123.pdf",
"Document page permalink": "link123,link456,link789",
"Translated files": "http://example.com|http://example.org|http://example.co.uk",
"Translated titles": "title123|title456|title789",
Expand All @@ -70,6 +74,7 @@ def mock_valid_doc_row_with_two_translations():
"ID (Unique ID from our CMS for the document)": "doc123",
"Type": "type123",
"Title": "title123",
"Main file (English)": "link123.pdf",
"Document page permalink": "link123,link456",
"Translated files": "http://example.com|http://example.org",
"Translated titles": "title123|title456",
Expand All @@ -86,6 +91,7 @@ def mock_valid_row():
"ID (Unique ID from our CMS for the document)": "doc123",
"Type": "type123",
"Title": "title123",
"Main file (English)": "link123.pdf",
"Document page permalink": "link123",
}
)
Expand All @@ -101,6 +107,7 @@ def mock_gcf_docs():
"Title": ["title123", "title124"],
"Translated titles": ["title123_fr", "title124_fr"],
"Document page permalink": ["link123", "link124"],
"Main file (English)": ["link123.pdf", "link124.pdf"],
"Translated files": ["file123_fr", "file124_fr"],
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ def test_map_document_metadata_without_source_url(mock_valid_row):
result = map_document_metadata(mock_valid_row, DocumentVariantNames.ORIGINAL.value)
assert (
"source_url" in result
and result["source_url"] == mock_valid_row["Document page permalink"]
and result["source_url"] == mock_valid_row["Main file (English)"]
)

0 comments on commit 933b4fa

Please sign in to comment.