Skip to content

Commit

Permalink
WIP on #487.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Aug 15, 2023
1 parent 0f2ade6 commit f010293
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 44 deletions.
7 changes: 4 additions & 3 deletions tests/assets/create_from_files_test/create.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
task: create_from_files
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: tests/assets/create_from_files_test/files
models:
- 'http://purl.org/coar/resource_type/c_1843': ['zip', 'tar', '']
- 'https://schema.org/DigitalDocument': ['pdf', 'doc', 'docx', 'ppt', 'pptx']
- 'http://purl.org/coar/resource_type/c_c513': ['tif', 'tiff', 'jp2', 'png', 'gif', 'jpg', 'jpeg']
- 'http://purl.org/coar/resource_type/c_18cc': ['mp3', 'wav', 'aac']
- 'http://purl.org/coar/resource_type/c_12ce': ['mp4']
log_json: true
# log_json: true
standalone_media_url: true
5 changes: 3 additions & 2 deletions tests/assets/create_from_files_test/delete.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
task: delete
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/create_from_files_test"
input_csv: /tmp/workbenchcreatefromfilestestnids.txt
standalone_media_url: true
4 changes: 2 additions & 2 deletions tests/assets/create_test/create.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task: create
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/create_test"
media_type: image
allow_missing_files: True
4 changes: 2 additions & 2 deletions tests/assets/create_test/delete.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
task: delete
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/create_test"
input_csv: /tmp/workbenchcreatetestnids.txt
10 changes: 5 additions & 5 deletions tests/assets/create_test/metadata.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
file,title,id,field_model,field_description
,Small boats in Havana Harbour,01,24,Taken on vacation in Cuba.
,Manhatten Island,02,24,"Taken from the ferry from downtown New York to Highlands, NJ. Weather was windy."
,Looking across Burrard Inlet,03,24,View from Deep Cove to Burnaby Mountain. Simon Fraser University is visible on the top of the mountain in the distance.
,Amsterdam waterfront,04,24,Amsterdam waterfront on an overcast day.
,Alcatraz Island,05,24,"Taken from Fisherman's Wharf, San Francisco."
,Small boats in Havana Harbour,01,Image,Taken on vacation in Cuba.
,Manhatten Island,02,Image,"Taken from the ferry from downtown New York to Highlands, NJ. Weather was windy."
,Looking across Burrard Inlet,03,Image,View from Deep Cove to Burnaby Mountain. Simon Fraser University is visible on the top of the mountain in the distance.
,Amsterdam waterfront,04,Image,Amsterdam waterfront on an overcast day.
,Alcatraz Island,05,Image,"Taken from Fisherman's Wharf, San Francisco."
4 changes: 2 additions & 2 deletions tests/assets/delete_test/create.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task: create
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/delete_test"
allow_missing_files: True
nodes_only: true
4 changes: 2 additions & 2 deletions tests/assets/delete_test/delete.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
task: delete
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/delete_test"
input_csv: /tmp/workbenchdeletetesttnids.txt
10 changes: 5 additions & 5 deletions tests/assets/delete_test/metadata.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
file,id,title,field_model,field_description
,01,Small boats in Havana Harbour,24,Taken on vacation in Cuba.
,02,Manhatten Island,24,"Taken from the ferry from downtown New York to Highlands, NJ. Weather was windy."
,03,Looking across Burrard Inlet,24,View from Deep Cove to Burnaby Mountain. Simon Fraser University is visible on the top of the mountain in the distance.
,04,Amsterdam waterfront,24,Amsterdam waterfront on an overcast day.
,05,Alcatraz Island,24,"Taken from Fisherman's Wharf, San Francisco."
,01,Small boats in Havana Harbour,Image,Taken on vacation in Cuba.
,02,Manhatten Island,Image,"Taken from the ferry from downtown New York to Highlands, NJ. Weather was windy."
,03,Looking across Burrard Inlet,Image,View from Deep Cove to Burnaby Mountain. Simon Fraser University is visible on the top of the mountain in the distance.
,04,Amsterdam waterfront,Image,Amsterdam waterfront on an overcast day.
,05,Alcatraz Island,Image,"Taken from Fisherman's Wharf, San Francisco."
4 changes: 2 additions & 2 deletions tests/assets/non_latin_text_test/create.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task: create
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/non_latin_text_test"
allow_missing_files: True
nodes_only: true
4 changes: 2 additions & 2 deletions tests/assets/non_latin_text_test/delete.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
task: delete
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/non_latin_text_test"
input_csv: /tmp/workbenchcreatenonlatintestnids.txt
6 changes: 3 additions & 3 deletions tests/assets/non_latin_text_test/metadata.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,field_model,title
1,25,一九二四年六月十二日
2,25,"सरकारी दस्तावेज़"
3,25,"ᐊᑕᐅᓯᖅ ᓄᓇ, ᐅᓄᖅᑐᑦ ᓂᐲᑦ"
1,Image,一九二四年六月十二日
2,Image,"सरकारी दस्तावेज़"
3,Image,"ᐊᑕᐅᓯᖅ ᓄᓇ, ᐅᓄᖅᑐᑦ ᓂᐲᑦ"
4 changes: 2 additions & 2 deletions tests/assets/update_test/create.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task: create
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/update_test"
input_csv: create.csv
allow_missing_files: true
4 changes: 2 additions & 2 deletions tests/assets/update_test/delete.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
task: delete
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/update_test"
input_csv: /tmp/workbenchupdatetestnids.txt
4 changes: 2 additions & 2 deletions tests/assets/update_test/update.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task: update
host: "http://localhost:8000"
host: https://islandora.traefik.me
username: admin
password: islandora
password: password
input_dir: "tests/assets/update_test"
input_csv: workbenchupdatetest.csv
validate_title_length: false
35 changes: 27 additions & 8 deletions tests/islandora_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def tearDown(self):
if os.path.exists(self.preprocessed_file_path):
os.remove(self.preprocessed_file_path)

self.preprocessed_nid_file_path = self.nid_file + '.preprocessed'
if os.path.exists(self.nid_file):
os.remove(self.nid_file)
if os.path.exists(self.preprocessed_nid_file_path):
os.remove(self.preprocessed_nid_file_path)


class TestCreateFromFiles(unittest.TestCase):

Expand Down Expand Up @@ -101,12 +107,17 @@ def tearDown(self):
if os.path.exists(self.rollback_file_path):
os.remove(self.rollback_file_path)

if os.path.exists(self.rollback_file_path):
os.remove(self.rollback_file_path)

self.preprocessed_nid_file_path = self.nid_file + '.preprocessed'
if os.path.exists(self.preprocessed_nid_file_path):
os.remove(self.preprocessed_nid_file_path)


class TestCreateWithNewTypedRelation(unittest.TestCase):
# Note: You can't run this test class on its own, e.g.,
# python3 tests/islandora_tests.py TestCreateWithNewTypedRelation.
# because passing "TestCreateWithNewTypedRelation" as an argument
# will cause the argparse parser to fail.
# Note: You can't run this test class on its own, e.g., python3 tests/islandora_tests.py TestCreateWithNewTypedRelation.
# because passing "TestCreateWithNewTypedRelation" as an argument will cause the argparse parser to fail.

def setUp(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -263,13 +274,17 @@ def tearDown(self):

os.remove(self.nid_file)
os.remove(self.update_metadata_file)
nid_file_preprocessed_file = os.path.join(self.temp_dir, 'workbenchupdatetestnids.txt.preprocessed')
if os.path.exists(nid_file_preprocessed_file):
os.remove(nid_file_preprocessed_file)
update_test_csv_preprocessed_file = os.path.join(self.temp_dir, 'workbenchupdatetest.csv.preprocessed')
if os.path.exists(update_test_csv_preprocessed_file):
os.remove(update_test_csv_preprocessed_file)


class TestTermFromUri(unittest.TestCase):
# Note: You can't run this test class on its own, e.g.,
# python3 tests/islandora_tests.py TestTermFromUri.
# because passing "TestTermFromUri" as an argument
# will cause the argparse parser to fail.
# Note: You can't run this test class on its own, e.g., python3 tests/islandora_tests.py TestTermFromUri
# because passing "TestTermFromUri" as an argument will cause the argparse parser to fail.

def test_term_from_uri(self):
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -357,6 +372,10 @@ def tearDown(self):
if os.path.exists(preprocessed_csv_path):
os.remove(preprocessed_csv_path)

nid_file_preprocessed_path = self.nid_file + '.preprocessed'
if os.path.exists(nid_file_preprocessed_path):
os.remove(nid_file_preprocessed_path)


class TestSecondaryTask(unittest.TestCase):

Expand Down

0 comments on commit f010293

Please sign in to comment.