gds-api-adapters 37.5.0 → 37.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gds_api/response.rb +1 -1
- data/lib/gds_api/version.rb +1 -1
- data/test/publishing_api_v2_test.rb +23 -14
- data/test/response_test.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd0e04ee1ee9e50c2462313ec3d6ef71ff0ed84b
|
4
|
+
data.tar.gz: b6f932bf549ea2810a9076d3e4fd24ba72e436f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb524b8dc79496b41421261d60e2f219813654f07ffb0a470fc8b22c21b21b01f9fdbfafd09cf76ec26df94521dab71cfd0e2025777cd640916066e35828a056
|
7
|
+
data.tar.gz: 787a2686e3065dbb6f83c2814b22234a995fb5684b8f7e7398b1760d9527270d990bb167198c51e00b2482d41a8bee03dfa5be48bddeb2c07053253b57e6bce5
|
data/lib/gds_api/response.rb
CHANGED
data/lib/gds_api/version.rb
CHANGED
@@ -120,15 +120,12 @@ describe GdsApi::PublishingApiV2 do
|
|
120
120
|
)
|
121
121
|
.will_respond_with(
|
122
122
|
status: 422,
|
123
|
-
body:
|
124
|
-
|
125
|
-
"
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
},
|
130
|
-
},
|
131
|
-
},
|
123
|
+
body: [
|
124
|
+
{
|
125
|
+
fragment: "#/base_path",
|
126
|
+
failed_attribute: "Pattern"
|
127
|
+
}
|
128
|
+
],
|
132
129
|
headers: {
|
133
130
|
"Content-Type" => "application/json; charset=utf-8"
|
134
131
|
}
|
@@ -136,18 +133,23 @@ describe GdsApi::PublishingApiV2 do
|
|
136
133
|
end
|
137
134
|
|
138
135
|
it "responds with 422 Unprocessable Entity" do
|
139
|
-
|
136
|
+
assert_raises GdsApi::HTTPClientError do
|
140
137
|
@api_client.put_content(@content_id, @content_item)
|
141
138
|
end
|
142
|
-
assert_equal 422, error.code
|
143
|
-
assert_equal "Unprocessable entity", error.error_details["error"]["message"]
|
144
139
|
end
|
145
140
|
end
|
146
141
|
|
147
142
|
describe "optimistic locking" do
|
148
143
|
describe "if the content item has not changed since it was requested" do
|
149
144
|
before do
|
150
|
-
@content_item = content_item_for_content_id(@content_id,
|
145
|
+
@content_item = content_item_for_content_id(@content_id,
|
146
|
+
"document_type" => "manual",
|
147
|
+
"schema_name" => "manual",
|
148
|
+
"locale" => "en",
|
149
|
+
"details" => { "body" => [] },
|
150
|
+
"previous_version" => "3"
|
151
|
+
)
|
152
|
+
@content_item.delete("format")
|
151
153
|
|
152
154
|
publishing_api
|
153
155
|
.given("the content item #{@content_id} is at version 3")
|
@@ -173,7 +175,14 @@ describe GdsApi::PublishingApiV2 do
|
|
173
175
|
|
174
176
|
describe "if the content item has changed in the meantime" do
|
175
177
|
before do
|
176
|
-
@content_item = content_item_for_content_id(@content_id,
|
178
|
+
@content_item = content_item_for_content_id(@content_id,
|
179
|
+
"document_type" => "manual",
|
180
|
+
"schema_name" => "manual",
|
181
|
+
"locale" => "en",
|
182
|
+
"details" => { "body" => [] },
|
183
|
+
"previous_version" => "2"
|
184
|
+
)
|
185
|
+
@content_item.delete("format")
|
177
186
|
|
178
187
|
publishing_api
|
179
188
|
.given("the content item #{@content_id} is at version 3")
|
data/test/response_test.rb
CHANGED
@@ -236,6 +236,11 @@ describe GdsApi::Response do
|
|
236
236
|
JSON.expects(:parse).never
|
237
237
|
assert_equal "VAT rates", @response["title"]
|
238
238
|
end
|
239
|
+
|
240
|
+
it "should allow using dig to access nested keys" do
|
241
|
+
skip unless RUBY_VERSION > "2.3"
|
242
|
+
assert_equal "1870", @response.dig("details", "need_id")
|
243
|
+
end
|
239
244
|
end
|
240
245
|
|
241
246
|
# TODO: When we remove `GdsApi.config.hash_response_for_requests`, this
|