Skip to content

Commit

Permalink
Merge pull request #876 from alphagov/update-expected-publishing-api-…
Browse files Browse the repository at this point in the history
…behaviour-regarding-percent-encoding-of-urls-in-responses

Change the expected Publishing API behaviour around included URLs
  • Loading branch information
cbaines authored Jan 4, 2019
2 parents e9dcaef + f015b55 commit 4da0de3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

* Change the expected Publishing API behaviour regarding percent-encoding of URLs included in responses.

# 55.0.2

* Add SocketError exception handling.
Expand Down
32 changes: 16 additions & 16 deletions test/publishing_api_v2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1293,9 +1293,9 @@ def content_item_for_content_id(content_id, attrs = {})
total: 4,
pages: 2,
current_page: 1,
links: [{ href: "http://example.org/v2/content?document_type=topic&fields[]=title&fields[]=base_path&per_page=2&page=2",
links: [{ href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=title&fields%5B%5D=base_path&per_page=2&page=2",
rel: "next" },
{ href: "http://example.org/v2/content?document_type=topic&fields[]=title&fields[]=base_path&per_page=2&page=1",
{ href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=title&fields%5B%5D=base_path&per_page=2&page=1",
rel: "self" }],
results: [
{ title: 'title_1', base_path: '/path_1' },
Expand All @@ -1320,9 +1320,9 @@ def content_item_for_content_id(content_id, attrs = {})
total: 4,
pages: 2,
current_page: 2,
links: [{ href: "http://example.org/v2/content?document_type=topic&fields[]=title&fields[]=base_path&per_page=2&page=1",
links: [{ href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=title&fields%5B%5D=base_path&per_page=2&page=1",
rel: "previous" },
{ href: "http://example.org/v2/content?document_type=topic&fields[]=title&fields[]=base_path&per_page=2&page=2",
{ href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=title&fields%5B%5D=base_path&per_page=2&page=2",
rel: "self" }],
results: [
{ title: 'title_3', base_path: '/path_3' },
Expand Down Expand Up @@ -1359,7 +1359,7 @@ def content_item_for_content_id(content_id, attrs = {})
pages: 1,
current_page: 1,
links: [{
href: "http://example.org/v2/content?document_type=topic&fields[]=title&fields[]=base_path&page=1",
href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=title&fields%5B%5D=base_path&page=1",
rel: "self"
}],
results: [
Expand All @@ -1380,7 +1380,7 @@ def content_item_for_content_id(content_id, attrs = {})
["total", 2],
["pages", 1],
["current_page", 1],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields[]=title&fields[]=base_path&page=1", "rel" => "self" }]],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields%5B%5D=title&fields%5B%5D=base_path&page=1", "rel" => "self" }]],
["results", [{ "title" => "Content Item A", "base_path" => "/a-base-path" }, { "title" => "Content Item B", "base_path" => "/another-base-path" }]]
], response.to_a
end
Expand All @@ -1404,7 +1404,7 @@ def content_item_for_content_id(content_id, attrs = {})
pages: 1,
current_page: 1,
links: [{
href: "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=locale&page=1",
href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=locale&page=1",
rel: "self"
}],
results: [
Expand All @@ -1424,7 +1424,7 @@ def content_item_for_content_id(content_id, attrs = {})
["total", 1],
["pages", 1],
["current_page", 1],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=locale&page=1", "rel" => "self" }]],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=locale&page=1", "rel" => "self" }]],
["results", [{ "content_id" => "bed722e6-db68-43e5-9079-063f623335a7", "locale" => "en" }]]
], response.to_a
end
Expand All @@ -1448,7 +1448,7 @@ def content_item_for_content_id(content_id, attrs = {})
pages: 1,
current_page: 1,
links: [{
href: "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=locale&locale=fr&page=1",
href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=locale&locale=fr&page=1",
rel: "self"
}],
results: [
Expand All @@ -1468,7 +1468,7 @@ def content_item_for_content_id(content_id, attrs = {})
["total", 1],
["pages", 1],
["current_page", 1],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=locale&locale=fr&page=1", "rel" => "self" }]],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=locale&locale=fr&page=1", "rel" => "self" }]],
["results", [{ "content_id" => "bed722e6-db68-43e5-9079-063f623335a7", "locale" => "fr" }]]
], response.to_a
end
Expand All @@ -1492,7 +1492,7 @@ def content_item_for_content_id(content_id, attrs = {})
pages: 1,
current_page: 1,
links: [{
href: "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=locale&locale=all&page=1",
href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=locale&locale=all&page=1",
rel: "self"
}],
results: [
Expand All @@ -1514,7 +1514,7 @@ def content_item_for_content_id(content_id, attrs = {})
["total", 3],
["pages", 1], ["current_page", 1],
["links",
[{ "href" => "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=locale&locale=all&page=1", "rel" => "self" }]],
[{ "href" => "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=locale&locale=all&page=1", "rel" => "self" }]],
["results",
[{ "content_id" => "bed722e6-db68-43e5-9079-063f623335a7", "locale" => "en" },
{ "content_id" => "bed722e6-db68-43e5-9079-063f623335a7", "locale" => "fr" },
Expand All @@ -1541,7 +1541,7 @@ def content_item_for_content_id(content_id, attrs = {})
pages: 1,
current_page: 1,
links: [{
href: "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=details&page=1",
href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=details&page=1",
rel: "self"
}],
results: [
Expand All @@ -1561,7 +1561,7 @@ def content_item_for_content_id(content_id, attrs = {})
["total", 1],
["pages", 1],
["current_page", 1],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields[]=content_id&fields[]=details&page=1", "rel" => "self" }]],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&fields%5B%5D=details&page=1", "rel" => "self" }]],
["results", [{ "content_id" => "bed722e6-db68-43e5-9079-063f623335a7", "details" => { "foo" => "bar" } }]]
], response.to_a
end
Expand All @@ -1585,7 +1585,7 @@ def content_item_for_content_id(content_id, attrs = {})
pages: 1,
current_page: 1,
links: [{
href: "http://example.org/v2/content?document_type=topic&fields[]=content_id&q=an+internal+name&search_in[]=details.internal_name&page=1",
href: "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&q=an+internal+name&search_in%5B%5D=details.internal_name&page=1",
rel: "self"
}],
results: [
Expand All @@ -1607,7 +1607,7 @@ def content_item_for_content_id(content_id, attrs = {})
["total", 1],
["pages", 1],
["current_page", 1],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields[]=content_id&q=an+internal+name&search_in[]=details.internal_name&page=1", "rel" => "self" }]],
["links", [{ "href" => "http://example.org/v2/content?document_type=topic&fields%5B%5D=content_id&q=an+internal+name&search_in%5B%5D=details.internal_name&page=1", "rel" => "self" }]],
["results", [{ "content_id" => "aaaaaaaa-aaaa-1aaa-aaaa-aaaaaaaaaaaa" }]]
], response.to_a
end
Expand Down

0 comments on commit 4da0de3

Please sign in to comment.