-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add METS download link to AIP page. (#46)
Adds a METS download link to the AIP detail page.
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
from flask import current_app | ||
from werkzeug.datastructures import Headers | ||
|
||
|
||
def test_download_mets(app_with_populated_files, mocker): | ||
# Mock storage server API request response | ||
request = mocker.patch("requests.get") | ||
|
||
class MockRespoonse(object): | ||
pass | ||
|
||
return_response = MockRespoonse() | ||
return_response.content = "METS content" | ||
return_response.status_code = 200 | ||
|
||
request.return_value = return_response | ||
|
||
# Test view logic | ||
with current_app.test_client() as test_client: | ||
response = test_client.get("/reporter/download_mets/1") | ||
assert response.headers == Headers( | ||
[ | ||
( | ||
"Content-Disposition", | ||
'attachment; filename="METS-111111111111-1111-1111-11111111.xml"', | ||
), | ||
("Content-Length", "12"), | ||
("Content-Type", "text/html; charset=utf-8"), | ||
] | ||
) | ||
|
||
assert response.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters