Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring metadata_prefix for ListIdentifiers, per OAI-PMH specs #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/oai/provider/response/list_identifiers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module OAI::Provider::Response

class ListIdentifiers < RecordResponse

required_parameters :metadata_prefix

def to_xml
result = provider.model.find(:all, options)

Expand Down
8 changes: 5 additions & 3 deletions test/activerecord_provider/tc_ar_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def test_get_record_alternate_identifier_column
end

def test_list_identifiers
assert_nothing_raised { REXML::Document.new(@provider.list_identifiers) }
doc = REXML::Document.new(@provider.list_identifiers)
assert_nothing_raised do
REXML::Document.new(@provider.list_identifiers(:metadata_prefix => 'oai_dc'))
end
doc = REXML::Document.new(@provider.list_identifiers(:metadata_prefix => 'oai_dc'))
assert_equal 100, doc.elements['OAI-PMH/ListIdentifiers'].to_a.size
end

Expand Down Expand Up @@ -163,7 +165,7 @@ def test_handles_empty_collections
test_metadata_formats
# ListIdentifiers and ListRecords should return "noRecordsMatch" error code
assert_raises(OAI::NoMatchException) do
REXML::Document.new(@provider.list_identifiers)
REXML::Document.new(@provider.list_identifiers(:metadata_prefix => 'oai_dc'))
end
assert_raises(OAI::NoMatchException) do
REXML::Document.new(@provider.list_records(:metadata_prefix => 'oai_dc'))
Expand Down
3 changes: 2 additions & 1 deletion test/provider/tc_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def test_additional_description
end

def test_list_identifiers_for_correct_xml
doc = REXML::Document.new(@mapped_provider.list_identifiers)
doc = REXML::Document.new(
@mapped_provider.list_identifiers(:metadata_prefix => 'oai_dc'))
assert_not_nil doc.elements['OAI-PMH/request']
assert_not_nil doc.elements['OAI-PMH/request/@verb']
assert_not_nil doc.elements['OAI-PMH/ListIdentifiers']
Expand Down