Skip to content

Commit

Permalink
do not add non-nids to CSVs
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Nov 15, 2024
1 parent 3c737db commit 6d9a948
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/islandora_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,15 @@ def setUp(self):
create_output = subprocess.check_output(self.create_cmd)
create_output = create_output.decode().strip()
create_lines = create_output.splitlines()
with open(self.nid_file, "a") as fh:
with open(self.nid_file, "w") as fh:
fh.write("node_id\n")
for line in create_lines:
if "created at" in line:
nid = line.rsplit("/", 1)[-1]
nid = nid.strip(".")
nids.append(nid)
fh.write(nid + "\n")
if workbench_utils.value_is_numeric(nid):
nids.append(nid)
fh.write(nid + "\n")

def test_delete(self):
delete_config_file_path = os.path.join(
Expand Down Expand Up @@ -429,14 +430,15 @@ def setUp(self):
create_output = create_output.decode().strip()
create_lines = create_output.splitlines()

with open(self.nid_file, "a") as nids_fh:
with open(self.nid_file, "w") as nids_fh:
nids_fh.write("node_id\n")
for line in create_lines:
if "created at" in line:
nid = line.rsplit("/", 1)[-1]
nid = nid.strip(".")
nids_fh.write(nid + "\n")
self.nids.append(nid)
if workbench_utils.value_is_numeric(nid):
nids_fh.write(nid + "\n")
self.nids.append(nid)

# Add some values to the update CSV file to test against.
with open(self.update_metadata_file, "a") as update_fh:
Expand Down Expand Up @@ -520,14 +522,15 @@ def test_create_with_non_latin_text(self):
create_output = subprocess.check_output(self.create_cmd)
create_output = create_output.decode().strip()
create_lines = create_output.splitlines()
with open(self.nid_file, "a") as fh:
with open(self.nid_file, "w") as fh:
fh.write("node_id\n")
for line in create_lines:
if "created at" in line:
nid = line.rsplit("/", 1)[-1]
nid = nid.strip(".")
nids.append(nid)
fh.write(nid + "\n")
if workbench_utils.value_is_numeric(nid):
nids.append(nid)
fh.write(nid + "\n")

self.assertEqual(len(nids), 3)

Expand Down

0 comments on commit 6d9a948

Please sign in to comment.