diff --git a/app/oaipmh/oai.py b/app/oaipmh/oai.py index cc5784bed..591a7cd63 100644 --- a/app/oaipmh/oai.py +++ b/app/oaipmh/oai.py @@ -598,22 +598,13 @@ def processRequest(self, request, metadata_dict): return response_xml - if request.method == 'GET': - verb = request.args.get('verb') - metadata_prefix = request.args.get('metadataPrefix') - identifier = request.args.get('identifier') - from_date = request.args.get('from') - until_date = request.args.get('until') - set_spec = request.args.get('set') - resumption_token = request.args.get('resumptionToken') - else: - verb = request.form.get('verb') - metadata_prefix = request.form.get('metadataPrefix') - identifier = request.form.get('identifier') - from_date = request.form.get('from') - until_date = request.form.get('until') - set_spec = request.form.get('set') - resumption_token = request.form.get('resumptionToken') + verb = request.args.get('verb', request.form.get('verb')) + metadata_prefix = request.args.get('metadataPrefix', request.form.get('metadataPrefix')) + identifier = request.args.get('identifier', request.form.get('identifier')) + from_date = request.args.get('from', request.form.get('from')) + until_date = request.args.get('until', request.form.get('until')) + set_spec = request.args.get('set', request.form.get('set')) + resumption_token = request.args.get('resumptionToken', request.form.get('resumptionToken')) # Create a dictionary mapping verbs to functions verb_handlers = { diff --git a/app/tests/test_app.py b/app/tests/test_app.py index 7cc5bbc3c..829f0859b 100644 --- a/app/tests/test_app.py +++ b/app/tests/test_app.py @@ -761,9 +761,11 @@ def test_oai(self): self.assertEqual(root.find(".//oaipmh:granularity", namespace).text, "YYYY-MM-DD") self.assertEqual(root.find(".//oaipmh:adminEmail", namespace).text, "support@example.com") - # Test Identify + # Test Identify Post res = self.client.post('/oai?verb=Identify') self.assertEqual(200, res.status_code) + root = etree.fromstring(res.data) + self.assertEqual(root.find(".//oaipmh:repositoryName", namespace).text, "IM Dashboard") # Test GetRecord tosca_id = "https://github.com/grycap/tosca/blob/main/templates/simple-node-disk.yml"