Skip to content

Conversation

@ojas-uls-dev
Copy link
Contributor

Created embargo.csv in embargo folder as well as a utility to allow creating csv testfiles from json

@ojas-uls-dev
Copy link
Contributor Author

ojas-uls-dev commented Oct 16, 2025

@ctgraham I have done most of the issues now. The remaining issues on pitt qa are

  • setting hyrax model (not sure exactly what that means) via metadata xml in post requests. T
  • versioning and api key permissions (I only have 1 api key, so can't test with it)

There's also a few cases for works having other works as children that I don't see an example of in default admin set. Otherwise I think the tests are now sufficient to be merged, and for some issues (like issue 379) to be closed on notch8 side.

Copy link
Member

@ctgraham ctgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An incomplete review, but it's been in draft over the weekend, and I wanted to get it out the door.

runtests.py Outdated
variables.pop(variable, None)

if source is None:
print("ERROR: expected data, but found None")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For error messaging, let's send this to the STDERR stream, e.g.:

print("message", file=sys.stderr)

runtests.py Outdated

if source is None:
print("ERROR: expected data, but found None")
print("Ignoring file writes")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any additional context we can provide here regarding implications of this failure? Perhaps the assignments which were skipped?

"Form": ["payload=files/EtdEmbargo.zip"],
"Expected":201,
"Store":["temp/post.body.out=*",
"WORKID=//*[local-name() = \"id\"]/text()",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably just an artifact from the original .sh script, but we don't really want any id or link element, but rather an id and link element from a specific namespace. The .sh does this by querying the namespace-uri() function because xmllint does not support namespace aliases or QNames.

WORKID=`xmllint --xpath '//*[local-name() = "id" and namespace-uri() = "http://www.w3.org/2005/Atom"]/text()' ../temp/post.body.out`
WORKEDIT=`xmllint --xpath '//*[local-name() = "link" and namespace-uri() = "http://www.w3.org/2005/Atom" and @rel="edit"]/@href' ../temp/post.body.out | cut -d'"' -f2`

We can do this with the atom alias.

"Method": "XSLT",
"URI": "embargo/get-first-fileset.xsl",
"Payload": "temp/post.body.out",
"Store":["FILESET_URL=//resultroot/*[1]/text()"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a simpler xpath would be /resultroot/result.

"URI": "embargo/h4cmeta.xsl",
"Payload": "temp/post.body.out",
"Store":["temp/post.metadata.xml=*"],
"Test": ["embargo=//metadata/visibility/text()",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these would be better with a root match (/) rather than a global search (//),

import csv
import sys

csv_headers = ("Title","Method","URI","Headers",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the CSV headers named here, but also in the YAMLs as a Headers entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants