-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NO-REF: Asserting manifests are uploaded during ingest (#544)
- Loading branch information
1 parent
c722464
commit 8222305
Showing
10 changed files
with
49 additions
and
21 deletions.
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
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
17 changes: 17 additions & 0 deletions
17
tests/functional/processes/ingest/assert_uploaded_manifests.py
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,17 @@ | ||
from model import Record | ||
from managers.s3 import S3Manager | ||
|
||
|
||
def assert_uploaded_manifests(records: list[Record]): | ||
s3_manager = S3Manager() | ||
s3_manager.createS3Client() | ||
|
||
for record in records: | ||
parts = record.get_parts() | ||
|
||
manifest_part = next((part for part in parts if part.file_type == 'application/webpub+json'), None) | ||
|
||
if manifest_part and 'epubs' not in manifest_part.url: | ||
manifest_head_response = s3_manager.s3Client.head_object(Key=manifest_part.get_file_key(), Bucket=manifest_part.get_file_bucket()) | ||
|
||
assert manifest_head_response is not None |
4 changes: 3 additions & 1 deletion
4
tests/functional/processes/ingest/test_chicago_isac_process.py
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from processes import ChicagoISACProcess | ||
from .assert_ingested_records import assert_ingested_records | ||
from .assert_uploaded_manifests import assert_uploaded_manifests | ||
|
||
|
||
def test_chigaco_isac_process(): | ||
isac_process = ChicagoISACProcess('complete', None, None, None, 5, None) | ||
|
||
isac_process.runProcess() | ||
|
||
assert_ingested_records(source_name='isac') | ||
records = assert_ingested_records(source_name='isac') | ||
assert_uploaded_manifests(records) |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from processes import DOABProcess | ||
from .assert_ingested_records import assert_ingested_records | ||
from .assert_uploaded_manifests import assert_uploaded_manifests | ||
|
||
|
||
def test_doab_process(): | ||
doab_process = DOABProcess('complete', None, None, None, 1, None) | ||
|
||
doab_process.runProcess() | ||
|
||
assert_ingested_records(source_name='doab') | ||
records = assert_ingested_records(source_name='doab') | ||
assert_uploaded_manifests(records) |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
from processes import GutenbergProcess | ||
from .assert_ingested_records import assert_ingested_records | ||
from .assert_uploaded_manifests import assert_uploaded_manifests | ||
|
||
|
||
def test_gutenberg_process(): | ||
gutenberg_process = GutenbergProcess('complete', None, None, None, 5, None) | ||
|
||
gutenberg_process.runProcess() | ||
|
||
assert_ingested_records(source_name='gutenberg') | ||
records = assert_ingested_records(source_name='gutenberg') | ||
|
||
assert_uploaded_manifests(records) |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from processes import LOCProcess | ||
from .assert_ingested_records import assert_ingested_records | ||
from .assert_uploaded_manifests import assert_uploaded_manifests | ||
|
||
|
||
def test_loc_process(): | ||
loc_process = LOCProcess('complete', None, None, None, 5, None) | ||
|
||
loc_process.runProcess() | ||
|
||
assert_ingested_records(source_name='loc') | ||
records = assert_ingested_records(source_name='loc') | ||
assert_uploaded_manifests(records) |
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 |
---|---|---|
@@ -1,22 +1,12 @@ | ||
from processes import METProcess | ||
from .assert_ingested_records import assert_ingested_records | ||
from managers.s3 import S3Manager | ||
from .assert_uploaded_manifests import assert_uploaded_manifests | ||
|
||
|
||
def test_met_process(): | ||
met_process = METProcess('complete', None, None, None, 5, None) | ||
|
||
met_process.runProcess() | ||
records = assert_ingested_records(source_name='met') | ||
|
||
s3_manager = S3Manager() | ||
s3_manager.createS3Client() | ||
|
||
for record in records: | ||
parts= record.get_parts() | ||
|
||
manifest_part = next(part for part in parts if part.file_type == 'application/webpub+json') | ||
|
||
manifest_head_response = s3_manager.s3Client.head_object(Key=manifest_part.get_file_key(), Bucket=manifest_part.get_file_bucket()) | ||
|
||
assert manifest_head_response is not None | ||
records = assert_ingested_records(source_name='met') | ||
assert_uploaded_manifests(records) |
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from processes import MUSEProcess | ||
from .assert_ingested_records import assert_ingested_records | ||
|
||
from .assert_uploaded_manifests import assert_uploaded_manifests | ||
|
||
|
||
def test_muse_process(): | ||
muse_process = MUSEProcess('complete', None, None, None, 5, None) | ||
|
||
muse_process.runProcess() | ||
|
||
assert_ingested_records(source_name='muse') | ||
records = assert_ingested_records(source_name='muse') | ||
|
||
assert_uploaded_manifests(records) |