Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/pdct-1554-map-gcf-source-url-to-document-pdf-not-url #25

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)"]
)
Loading