-
Notifications
You must be signed in to change notification settings - Fork 224
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
ANW-1843: add toggle to exclude <unitid> containing ASpace URI from EAD #3188
Changes from all commits
7665744
be59834
f13ad9b
e588bd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,9 +209,12 @@ def archival_object(index) | |
|
||
as_test_user("admin", true) do | ||
load_export_fixtures | ||
@doc = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true&ead3=true") | ||
@doc = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true&include_uri_unitids=true&ead3=true") | ||
@doc_nsless = Nokogiri::XML::Document.parse(@doc.to_xml) | ||
@doc_nsless.remove_namespaces! | ||
@doc_uri_disabled = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_daos=true&include_uri_unitids=false") | ||
@doc_no_uri_param_present = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_daos=true") | ||
|
||
raise Sequel::Rollback | ||
end | ||
end | ||
|
@@ -419,6 +422,14 @@ def archival_object(index) | |
mt(object.uri, "#{desc_path}/did/unitid[@localtype='aspace_uri']") | ||
end | ||
|
||
it "does not map {archival_object}.uri to {desc_path}/did/unitid[@type='aspace_uri'] if flag disabled" do | ||
expect(@doc_uri_disabled).not_to have_node(desc_path + "/did/unitid[@type='aspace_uri']") | ||
end | ||
|
||
it "does maps {archival_object}.uri to {desc_path}/did/unitid[@type='aspace_uri'] if flag not present" do | ||
expect(@doc_no_uri_param_present).to have_node(desc_path + "/did/unitid[@type='aspace_uri']") | ||
end | ||
|
||
it "maps {archival_object}.(id_[0-3]|component_id) to {desc_path}/did/unitid" do | ||
if !unitid_src.nil? && !unitid_src.empty? | ||
mt(unitid_src, "#{desc_path}/did/unitid") | ||
|
@@ -1377,7 +1388,7 @@ def description_content(obj) | |
describe "Test unpublished record EAD exports" do | ||
|
||
def get_xml_doc(include_unpublished = false) | ||
doc_for_unpublished_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@unpublished_resource_jsonmodel.id}.xml?include_unpublished=#{include_unpublished}&include_daos=true&ead3=true", true) | ||
doc_for_unpublished_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@unpublished_resource_jsonmodel.id}.xml?include_unpublished=#{include_unpublished}&include_daos=true&include_uri_unitids=true&ead3=true", true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here, we should ensure that the default behavior happens if no |
||
|
||
doc_nsless_for_unpublished_resource = Nokogiri::XML::Document.parse(doc_for_unpublished_resource) | ||
doc_nsless_for_unpublished_resource.remove_namespaces! | ||
|
@@ -1483,7 +1494,7 @@ def get_xml_doc(include_unpublished = false) | |
def get_xml_doc | ||
as_test_user("admin") do | ||
DB.open(true) do | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource_jsonmodel.id}.xml?include_unpublished=true&include_daos=true", true) | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource_jsonmodel.id}.xml?include_unpublished=true&include_daos=true&include_uri_unitids=true", true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. We should check that the default behavior is happening both
|
||
|
||
doc_nsless_for_resource = Nokogiri::XML::Document.parse(doc_for_resource) | ||
doc_nsless_for_resource.remove_namespaces! | ||
|
@@ -1579,7 +1590,7 @@ def get_xml_doc | |
def get_xml_doc | ||
as_test_user("admin") do | ||
DB.open(true) do | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true&ead3=true", true) | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true&include_uri_unitids=true&ead3=true", true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. We should check that the default behavior is happening both
|
||
|
||
doc_nsless_for_resource = Nokogiri::XML::Document.parse(doc_for_resource) | ||
doc_nsless_for_resource.remove_namespaces! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,8 +247,9 @@ def archival_object(index) | |
|
||
as_test_user("admin", true) do | ||
load_export_fixtures | ||
@doc = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true") | ||
@doc_unpub = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_daos=true") | ||
@doc = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true&include_uri_unitids=true") | ||
@doc_unpub = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_daos=true&include_uri_unitids=true") | ||
@doc_no_uri = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_daos=true&include_uri_unitids=false") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment. We should also add the case when no |
||
@doc_nsless = Nokogiri::XML::Document.parse(@doc.to_xml) | ||
@doc_nsless.remove_namespaces! | ||
|
@@ -301,6 +302,10 @@ def archival_object(index) | |
mt(object.uri, "#{desc_path}/did/unitid[@type='aspace_uri']") | ||
end | ||
|
||
it "does not map {archival_object}.uri to {desc_path}/did/unitid[@type='aspace_uri'] if flag disabled" do | ||
expect(@doc_no_uri).not_to have_node(desc_path + "/did/unitid[@type='aspace_uri']") | ||
end | ||
|
||
it "maps {archival_object}.lang_materials['language_and_script'] to {desc_path}/did/langmaterial/language" do | ||
|
||
language = object.lang_materials[0]['language_and_script']['language'] | ||
|
@@ -1319,7 +1324,7 @@ def description_content(obj) | |
def get_xml_doc(include_unpublished = false) | ||
as_test_user("admin") do | ||
DB.open(true) do | ||
doc_for_unpublished_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@unpublished_resource_jsonmodel.id}.xml?include_unpublished=#{include_unpublished}&include_daos=true", true) | ||
doc_for_unpublished_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@unpublished_resource_jsonmodel.id}.xml?include_unpublished=#{include_unpublished}&include_daos=true&include_uri_unitids=true", true) | ||
|
||
doc_nsless_for_unpublished_resource = Nokogiri::XML::Document.parse(doc_for_unpublished_resource) | ||
doc_nsless_for_unpublished_resource.remove_namespaces! | ||
|
@@ -1454,7 +1459,7 @@ def get_xml_doc(include_unpublished = false) | |
def get_xml_doc | ||
as_test_user("admin") do | ||
DB.open(true) do | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource_jsonmodel.id}.xml?include_unpublished=true&include_daos=true", true) | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource_jsonmodel.id}.xml?include_unpublished=true&include_daos=true&include_uri_unitids=true", true) | ||
|
||
doc_nsless_for_resource = Nokogiri::XML::Document.parse(doc_for_resource) | ||
doc_nsless_for_resource.remove_namespaces! | ||
|
@@ -1533,7 +1538,7 @@ def get_xml_doc | |
def get_xml_doc | ||
as_test_user("admin") do | ||
DB.open(true) do | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true", true) | ||
doc_for_resource = get_xml("/repositories/#{$repo_id}/resource_descriptions/#{@resource.id}.xml?include_unpublished=true&include_daos=true&include_uri_unitids=true", true) | ||
|
||
doc_nsless_for_resource = Nokogiri::XML::Document.parse(doc_for_resource) | ||
doc_nsless_for_resource.remove_namespaces! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep a test that checks that the default behavior (the one that is currently happening on master) also continues to happen on these changes if no
include_uri_unitids
parameter is present in the request.