Skip to content

Commit

Permalink
Merge pull request #543 from grycap/egi_brand_v2
Browse files Browse the repository at this point in the history
Fix OAI POST
  • Loading branch information
micafer authored May 9, 2024
2 parents 1e15a51 + 9de85ca commit 9c7b779
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def create_app(oidc_blueprint=None):
else:
key = None
cred = DBCredentials(settings.db_url, key)
CSRFProtect(app)
csrf = CSRFProtect(app)
infra = Infrastructures(settings.db_url)
im = InfrastructureManager(settings.imUrl, settings.imTimeout)
ssh_key = SSHKey(settings.db_url)
Expand Down Expand Up @@ -1494,6 +1494,7 @@ def manage_vault_info():
return redirect(url_for('manage_creds'))

@app.route('/oai', methods=['GET', 'POST'])
@csrf.exempt
def oai_pmh():
if not settings.oaipmh_repo_name:
return make_response("OAI-PMH not enabled.", 404, {'Content-Type': 'text/plain'})
Expand Down
4 changes: 4 additions & 0 deletions app/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,10 @@ def test_oai(self):
self.assertEqual(root.find(".//oaipmh:granularity", namespace).text, "YYYY-MM-DD")
self.assertEqual(root.find(".//oaipmh:adminEmail", namespace).text, "[email protected]")

# Test Identify
res = self.client.post('/oai?verb=Identify')
self.assertEqual(200, res.status_code)

# Test GetRecord
tosca_id = "https://github.com/grycap/tosca/blob/main/templates/simple-node-disk.yml"
res = self.client.get('/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=%s' % tosca_id)
Expand Down

0 comments on commit 9c7b779

Please sign in to comment.