gds-api-adapters 38.1.0 → 39.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/test_helpers/need_api.rb +0 -15
- data/lib/gds_api/test_helpers/organisations.rb +5 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +3 -103
- data/test/asset_manager_test.rb +0 -94
- data/test/business_support_api_test.rb +0 -45
- data/test/content_api_test.rb +0 -712
- data/test/content_store_test.rb +0 -55
- data/test/email_alert_api_test.rb +0 -189
- data/test/fixtures/finder_api/cma-case-schema.json +0 -103
- data/test/fixtures/hello.txt +0 -1
- data/test/fixtures/new_policies_for_dwp.json +0 -298
- data/test/fixtures/no_services_and_info_data_found_fixture.json +0 -14
- data/test/fixtures/old_policies_for_dwp.json +0 -413
- data/test/fixtures/services_and_info_fixture.json +0 -73
- data/test/fixtures/sub_sector_organisations.json +0 -57
- data/test/fixtures/world_organisations_australia.json +0 -490
- data/test/gds_api_base_test.rb +0 -110
- data/test/gov_uk_delivery_test.rb +0 -67
- data/test/govuk_headers_test.rb +0 -30
- data/test/helpers_test.rb +0 -23
- data/test/imminence_api_test.rb +0 -196
- data/test/json_client_test.rb +0 -879
- data/test/licence_application_api_test.rb +0 -196
- data/test/list_response_test.rb +0 -189
- data/test/local_links_manager_api_test.rb +0 -236
- data/test/mapit_test.rb +0 -117
- data/test/maslow_test.rb +0 -12
- data/test/middleware/govuk_header_sniffer_test.rb +0 -18
- data/test/need_api_test.rb +0 -345
- data/test/organisations_api_test.rb +0 -58
- data/test/panopticon_registerer_test.rb +0 -118
- data/test/panopticon_test.rb +0 -190
- data/test/pp_data_in_test.rb +0 -52
- data/test/pp_data_out_test.rb +0 -24
- data/test/publishing_api/special_route_publisher_test.rb +0 -104
- data/test/publishing_api_test.rb +0 -186
- data/test/publishing_api_v2/get_expanded_links_test.rb +0 -85
- data/test/publishing_api_v2/get_links_test.rb +0 -89
- data/test/publishing_api_v2/lookup_test.rb +0 -70
- data/test/publishing_api_v2_test.rb +0 -1649
- data/test/response_test.rb +0 -245
- data/test/router_test.rb +0 -456
- data/test/rummager_helpers_test.rb +0 -20
- data/test/rummager_test.rb +0 -150
- data/test/support_api_test.rb +0 -189
- data/test/support_test.rb +0 -95
- data/test/test_helper.rb +0 -55
- data/test/test_helpers/email_alert_api_test.rb +0 -24
- data/test/test_helpers/pact_helper.rb +0 -13
- data/test/test_helpers/panopticon_test.rb +0 -44
- data/test/test_helpers/publishing_api_test.rb +0 -129
- data/test/test_helpers/publishing_api_v2_test.rb +0 -170
- data/test/worldwide_api_test.rb +0 -82
data/test/mapit_test.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'gds_api/mapit'
|
3
|
-
require 'gds_api/test_helpers/mapit'
|
4
|
-
|
5
|
-
describe GdsApi::Mapit do
|
6
|
-
include GdsApi::TestHelpers::Mapit
|
7
|
-
|
8
|
-
before do
|
9
|
-
@base_api_url = Plek.current.find("mapit")
|
10
|
-
@api = GdsApi::Mapit.new(@base_api_url)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "postcodes" do
|
14
|
-
it "should return the coordinates" do
|
15
|
-
mapit_has_a_postcode("SW1A 1AA", [51.5010096, -0.1415870])
|
16
|
-
|
17
|
-
response = @api.location_for_postcode("SW1A 1AA")
|
18
|
-
assert_equal 51.5010096, response.lat
|
19
|
-
assert_equal(-0.1415870, response.lon)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should return the postcode" do
|
23
|
-
mapit_has_a_postcode("SW1A 1AA", [51.5010096, -0.1415870])
|
24
|
-
|
25
|
-
response = @api.location_for_postcode("SW1A 1AA")
|
26
|
-
assert_equal "SW1A 1AA", response.postcode
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return areas" do
|
30
|
-
mapit_has_a_postcode_and_areas("SW1A 1AA", [51.5010096, -0.1415870], [
|
31
|
-
{ 'name' => 'Lancashire County Council', 'type' => 'CTY', 'ons' => '30', 'gss' => 'E10000017' },
|
32
|
-
{ 'name' => 'South Ribble Borough Council', 'type' => 'DIS', 'ons' => '30UN', 'gss' => 'E07000126' }
|
33
|
-
])
|
34
|
-
|
35
|
-
response = @api.location_for_postcode("SW1A 1AA")
|
36
|
-
assert_equal 2, response.areas.length
|
37
|
-
|
38
|
-
assert_equal "Lancashire County Council", response.areas.first.name
|
39
|
-
assert_equal "South Ribble Borough Council", response.areas.last.name
|
40
|
-
|
41
|
-
assert_equal "CTY", response.areas.first.type
|
42
|
-
assert_equal "DIS", response.areas.last.type
|
43
|
-
|
44
|
-
assert_equal "30", response.areas.first.codes['ons']
|
45
|
-
assert_equal "30UN", response.areas.last.codes['ons']
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should raise if a postcode doesn't exist" do
|
49
|
-
mapit_does_not_have_a_postcode("SW1A 1AA")
|
50
|
-
|
51
|
-
assert_raises(GdsApi::HTTPNotFound) do
|
52
|
-
@api.location_for_postcode("SW1A 1AA")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should return 400 for an invalid postcode" do
|
57
|
-
mapit_does_not_have_a_bad_postcode("B4DP05TC0D3")
|
58
|
-
|
59
|
-
assert_raises GdsApi::HTTPClientError do
|
60
|
-
@api.location_for_postcode("B4DP05TC0D3")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "areas_for_type" do
|
66
|
-
before do
|
67
|
-
mapit_has_areas('EUR', "123" => { "name" => "Eastern", "id" => "123", "country_name" => "England" },
|
68
|
-
"234" => { "name" => "North West", "id" => "234", "country_name" => "England" },
|
69
|
-
"345" => { "name" => "Scotland", "id" => "345", "country_name" => "Scotland" })
|
70
|
-
mapit_does_not_have_areas('FOO')
|
71
|
-
end
|
72
|
-
it "should return areas of a type" do
|
73
|
-
areas = @api.areas_for_type('EUR').to_hash
|
74
|
-
|
75
|
-
assert_equal 3, areas.size
|
76
|
-
assert_equal "Eastern", areas["123"]["name"]
|
77
|
-
assert_equal "England", areas["123"]["country_name"]
|
78
|
-
assert_equal "North West", areas["234"]["name"]
|
79
|
-
assert_equal "England", areas["234"]["country_name"]
|
80
|
-
assert_equal "Scotland", areas["345"]["name"]
|
81
|
-
assert_equal "Scotland", areas["345"]["country_name"]
|
82
|
-
end
|
83
|
-
it "should return and empty result for an unknown area type" do
|
84
|
-
response = @api.areas_for_type('FOO')
|
85
|
-
|
86
|
-
assert_empty response.parsed_content
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "area_for_code" do
|
91
|
-
before do
|
92
|
-
south_ribble_area = {
|
93
|
-
name: "South Ribble Borough Council",
|
94
|
-
codes: {
|
95
|
-
ons: "30UN",
|
96
|
-
gss: "E07000126",
|
97
|
-
unit_id: "4834"
|
98
|
-
},
|
99
|
-
type: "DIS"
|
100
|
-
}
|
101
|
-
mapit_has_area_for_code('ons', '30UN', south_ribble_area)
|
102
|
-
mapit_does_not_have_area_for_code('govuk_slug', 'neverland')
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should return area for a code type" do
|
106
|
-
area = @api.area_for_code('ons', '30UN')
|
107
|
-
|
108
|
-
assert_equal "South Ribble Borough Council", area["name"]
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should return 404 for a missing area of a certain code type" do
|
112
|
-
assert_raises(GdsApi::HTTPNotFound) do
|
113
|
-
@api.area_for_code('govuk_slug', 'neverland')
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
data/test/maslow_test.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'gds_api/maslow'
|
3
|
-
|
4
|
-
describe GdsApi::Maslow do
|
5
|
-
before do
|
6
|
-
@api = GdsApi::Maslow.new("http://maslow.dev.gov.uk")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should provide a URL to need pages" do
|
10
|
-
assert_equal "http://maslow.dev.gov.uk/needs/12345", @api.need_page_url(12345)
|
11
|
-
end
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'gds_api/middleware/govuk_header_sniffer'
|
3
|
-
|
4
|
-
describe GdsApi::GovukHeaderSniffer do
|
5
|
-
include Rack::Test::Methods
|
6
|
-
|
7
|
-
let(:inner_app) do
|
8
|
-
lambda { |_env| [200, { 'Content-Type' => 'text/plain' }, ['All good!']] }
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:app) { GdsApi::GovukHeaderSniffer.new(inner_app, 'HTTP_GOVUK_REQUEST_ID') }
|
12
|
-
|
13
|
-
it "sniffs custom request headers and stores them for later use" do
|
14
|
-
header "Govuk-Request-Id", "12345"
|
15
|
-
get "/"
|
16
|
-
assert_equal '12345', GdsApi::GovukHeaders.headers[:govuk_request_id]
|
17
|
-
end
|
18
|
-
end
|
data/test/need_api_test.rb
DELETED
@@ -1,345 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'gds_api/need_api'
|
3
|
-
require 'gds_api/test_helpers/need_api'
|
4
|
-
|
5
|
-
describe GdsApi::NeedApi do
|
6
|
-
include GdsApi::TestHelpers::NeedApi
|
7
|
-
|
8
|
-
before do
|
9
|
-
@base_api_url = Plek.current.find("need-api")
|
10
|
-
@api = GdsApi::NeedApi.new(@base_api_url)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "requesting needs by ID" do
|
14
|
-
before do
|
15
|
-
need_api_has_need_ids([
|
16
|
-
{
|
17
|
-
"id" => "1",
|
18
|
-
"role" => "parent",
|
19
|
-
"goal" => "apply for a primary school place",
|
20
|
-
"benefit" => "my child can start school",
|
21
|
-
},
|
22
|
-
{
|
23
|
-
"id" => "2",
|
24
|
-
"role" => "user",
|
25
|
-
"goal" => "find out about becoming a British citizen",
|
26
|
-
"benefit" => "i can take the correct steps to apply for citizenship",
|
27
|
-
},
|
28
|
-
{
|
29
|
-
"id" => "3",
|
30
|
-
"role" => "user",
|
31
|
-
"goal" => "find out about unemployment benefits",
|
32
|
-
"benefit" => "i have financial support whilst unemployed",
|
33
|
-
}
|
34
|
-
])
|
35
|
-
end
|
36
|
-
|
37
|
-
it "returns a list of needs matching the IDs" do
|
38
|
-
needs = @api.needs_by_id(1, 2, 3)
|
39
|
-
|
40
|
-
assert_equal 3, needs.count
|
41
|
-
assert_equal %w(1 2 3), needs.map { |need| need['id'] }
|
42
|
-
assert_equal "apply for a primary school place", needs['results'][0]['goal']
|
43
|
-
assert_equal "find out about becoming a British citizen", needs['results'][1]['goal']
|
44
|
-
assert_equal "find out about unemployment benefits", needs['results'][2]['goal']
|
45
|
-
end
|
46
|
-
|
47
|
-
it "makes the same request regardless of the order of the IDs" do
|
48
|
-
needs = @api.needs_by_id(2, 1, 3)
|
49
|
-
|
50
|
-
assert_equal 3, needs.count
|
51
|
-
assert_equal %w(1 2 3), needs.map { |need| need['id'] }
|
52
|
-
end
|
53
|
-
|
54
|
-
it "correctly sorts IDs requested as strings" do
|
55
|
-
needs = @api.needs_by_id(%w(02 3 1))
|
56
|
-
|
57
|
-
assert_equal 3, needs.count
|
58
|
-
assert_equal %w(1 2 3), needs.map { |need| need['id'] }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "requesting needs" do
|
63
|
-
it "should return a list of all needs" do
|
64
|
-
req = need_api_has_needs([
|
65
|
-
{
|
66
|
-
"role" => "parent",
|
67
|
-
"goal" => "apply for a primary school place",
|
68
|
-
"benefit" => "my child can start school",
|
69
|
-
"organisation_ids" => ["department-for-education"],
|
70
|
-
"organisations" => [
|
71
|
-
{
|
72
|
-
"id" => "department-for-education",
|
73
|
-
"name" => "Department for Education",
|
74
|
-
}
|
75
|
-
],
|
76
|
-
"justifications" => [
|
77
|
-
"it's something only government does",
|
78
|
-
"the government is legally obliged to provide it"
|
79
|
-
],
|
80
|
-
"impact" => "Has serious consequences for the day-to-day lives of your users",
|
81
|
-
"met_when" => [
|
82
|
-
"The user applies for a school place"
|
83
|
-
]
|
84
|
-
},
|
85
|
-
{
|
86
|
-
"role" => "user",
|
87
|
-
"goal" => "find out about becoming a British citizen",
|
88
|
-
"benefit" => "i can take the correct steps to apply for citizenship",
|
89
|
-
"organisation_ids" => ["home-office"],
|
90
|
-
"organisations" => [
|
91
|
-
{
|
92
|
-
"id" => "home-office",
|
93
|
-
"name" => "Home Office",
|
94
|
-
}
|
95
|
-
],
|
96
|
-
"justifications" => [
|
97
|
-
"it's something only government does",
|
98
|
-
"the government is legally obliged to provide it"
|
99
|
-
],
|
100
|
-
"impact" => "Has serious consequences for the day-to-day lives of your users",
|
101
|
-
"met_when" => [
|
102
|
-
"The user finds information about the citizenship test and the next steps"
|
103
|
-
]
|
104
|
-
}
|
105
|
-
])
|
106
|
-
|
107
|
-
needs = @api.needs
|
108
|
-
|
109
|
-
assert_requested(req)
|
110
|
-
assert_equal 2, needs.count
|
111
|
-
|
112
|
-
assert_equal %w(parent user), needs.map { |need| need['role'] }
|
113
|
-
assert_equal(
|
114
|
-
[
|
115
|
-
"apply for a primary school place",
|
116
|
-
"find out about becoming a British citizen"
|
117
|
-
],
|
118
|
-
needs.map { |need| need['goal'] }
|
119
|
-
)
|
120
|
-
assert_equal(
|
121
|
-
[
|
122
|
-
"my child can start school",
|
123
|
-
"i can take the correct steps to apply for citizenship"
|
124
|
-
],
|
125
|
-
needs.map { |need| need['benefit'] }
|
126
|
-
)
|
127
|
-
|
128
|
-
assert_equal(
|
129
|
-
"department-for-education",
|
130
|
-
needs.first['organisations'].first['id']
|
131
|
-
)
|
132
|
-
assert_equal(
|
133
|
-
"Department for Education",
|
134
|
-
needs.first['organisations'].first['name']
|
135
|
-
)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe "creating needs" do
|
140
|
-
it "should post to the right endpoint" do
|
141
|
-
request_stub = stub_request(:post, @base_api_url + "/needs").with(
|
142
|
-
body: '{"goal":"I wanna sammich!"}'
|
143
|
-
)
|
144
|
-
@api.create_need("goal" => "I wanna sammich!")
|
145
|
-
assert_requested(request_stub)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe "filtering needs by organisation" do
|
150
|
-
it "should return a subset of needs" do
|
151
|
-
req = need_api_has_needs_for_organisation("ministry-of-justice", [
|
152
|
-
{
|
153
|
-
"role" => "parent",
|
154
|
-
"goal" => "apply for a primary school place",
|
155
|
-
"benefit" => "my child can start school",
|
156
|
-
"organisation_ids" => ["ministry-of-justice"],
|
157
|
-
"organisations" => [
|
158
|
-
{
|
159
|
-
"id" => "ministry-of-justice",
|
160
|
-
"name" => "Ministry of Justice",
|
161
|
-
}
|
162
|
-
],
|
163
|
-
"justifications" => [
|
164
|
-
"it's something only government does",
|
165
|
-
"the government is legally obliged to provide it"
|
166
|
-
],
|
167
|
-
"impact" => "Has serious consequences for the day-to-day lives of your users",
|
168
|
-
"met_when" => [
|
169
|
-
"The user applies for a school place"
|
170
|
-
]
|
171
|
-
},
|
172
|
-
{
|
173
|
-
"role" => "user",
|
174
|
-
"goal" => "find out about becoming a British citizen",
|
175
|
-
"benefit" => "i can take the correct steps to apply for citizenship",
|
176
|
-
"organisation_ids" => ["ministry-of-justice"],
|
177
|
-
"organisations" => [
|
178
|
-
{
|
179
|
-
"id" => "ministry-of-justice",
|
180
|
-
"name" => "Ministry of Justice",
|
181
|
-
}
|
182
|
-
],
|
183
|
-
"justifications" => [
|
184
|
-
"it's something only government does",
|
185
|
-
"the government is legally obliged to provide it"
|
186
|
-
],
|
187
|
-
"impact" => "Has serious consequences for the day-to-day lives of your users",
|
188
|
-
"met_when" => [
|
189
|
-
"The user finds information about the citizenship test and the next steps"
|
190
|
-
]
|
191
|
-
}
|
192
|
-
])
|
193
|
-
|
194
|
-
@api.needs(organisation_id: "ministry-of-justice")
|
195
|
-
assert_requested(req)
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
describe "viewing needs" do
|
200
|
-
it "should return a need response" do
|
201
|
-
need = {
|
202
|
-
id: 100500,
|
203
|
-
role: "parent",
|
204
|
-
goal: "do things",
|
205
|
-
benefit: "good things"
|
206
|
-
}
|
207
|
-
need_api_has_need(need)
|
208
|
-
|
209
|
-
need_response = @api.need(100500)
|
210
|
-
assert_equal "good things", need_response['benefit']
|
211
|
-
end
|
212
|
-
|
213
|
-
it "should raise for a missing need" do
|
214
|
-
need_api_has_no_need(100600)
|
215
|
-
|
216
|
-
assert_raises(GdsApi::HTTPNotFound) do
|
217
|
-
@api.need(100600)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
describe "viewing content_ids for needs" do
|
223
|
-
it "should return the content_id for a need_id" do
|
224
|
-
need = {
|
225
|
-
id: 100700,
|
226
|
-
content_id: "abcdef-12345",
|
227
|
-
role: "need",
|
228
|
-
goal: "needy",
|
229
|
-
benefit: "needless"
|
230
|
-
}
|
231
|
-
need_api_has_content_id_for_need(need)
|
232
|
-
|
233
|
-
need_response = @api.content_id(100700)
|
234
|
-
assert_equal 'abcdef-12345', need_response.body
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
describe "updating needs" do
|
239
|
-
it "should send a PUT request" do
|
240
|
-
updated_fields = {
|
241
|
-
role: "parent",
|
242
|
-
goal: "do things",
|
243
|
-
benefit: "good things"
|
244
|
-
}
|
245
|
-
|
246
|
-
update_stub = stub_request(:put, @base_api_url + "/needs/100005")
|
247
|
-
.with(body: updated_fields.to_json)
|
248
|
-
.to_return(status: 204)
|
249
|
-
@api.update_need(100005, updated_fields)
|
250
|
-
assert_requested update_stub
|
251
|
-
end
|
252
|
-
|
253
|
-
it "should accept partial updates" do
|
254
|
-
updated_fields = { role: "parent" }
|
255
|
-
|
256
|
-
update_stub = stub_request(:put, @base_api_url + "/needs/100005")
|
257
|
-
.with(body: updated_fields.to_json)
|
258
|
-
.to_return(status: 204)
|
259
|
-
@api.update_need(100005, updated_fields)
|
260
|
-
assert_requested update_stub
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
describe "viewing organisations" do
|
265
|
-
it "should return a list of organisations" do
|
266
|
-
request_stub = need_api_has_organisations(
|
267
|
-
"committee-on-climate-change" => "Committee on Climate Change",
|
268
|
-
"competition-commission" => "Competition Commission"
|
269
|
-
)
|
270
|
-
|
271
|
-
orgs = @api.organisations
|
272
|
-
|
273
|
-
assert_requested(request_stub)
|
274
|
-
assert_equal "Committee on Climate Change", orgs[0]["name"]
|
275
|
-
assert_equal "Competition Commission", orgs[1]["name"]
|
276
|
-
assert_equal 2, orgs.size
|
277
|
-
end
|
278
|
-
|
279
|
-
it "should return organisations with abbreviations if present" do
|
280
|
-
request_stub = need_api_has_organisations(
|
281
|
-
"committee-on-climate-change" => { "name" => "Committee on Climate Change",
|
282
|
-
"abbreviation" => "CCC" },
|
283
|
-
"competition-commission" => { "name" => "Competition Commission",
|
284
|
-
"abbreviation" => "CC" }
|
285
|
-
)
|
286
|
-
orgs = @api.organisations
|
287
|
-
|
288
|
-
assert_requested(request_stub)
|
289
|
-
assert_equal "Committee on Climate Change", orgs[0]["name"]
|
290
|
-
assert_equal "Competition Commission", orgs[1]["name"]
|
291
|
-
assert_equal "CCC", orgs[0]["abbreviation"]
|
292
|
-
assert_equal "CC", orgs[1]["abbreviation"]
|
293
|
-
assert_equal 2, orgs.size
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
describe "closing needs as duplicates" do
|
298
|
-
it "should send a PUT request" do
|
299
|
-
fields = {
|
300
|
-
duplicate_of: 100001
|
301
|
-
}
|
302
|
-
|
303
|
-
duplicate_stub = stub_request(:put, @base_api_url + "/needs/100005/closed")
|
304
|
-
.with(body: fields.to_json)
|
305
|
-
.to_return(status: 204)
|
306
|
-
@api.close(100005, fields)
|
307
|
-
assert_requested duplicate_stub
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
describe "reopening closed needs" do
|
312
|
-
it "should send a DELETE request" do
|
313
|
-
fields = {
|
314
|
-
author: {
|
315
|
-
name: "Winston Smith-Churchill",
|
316
|
-
email: "winston@alphagov.co.uk"
|
317
|
-
}
|
318
|
-
}
|
319
|
-
|
320
|
-
reopen_stub = stub_request(:delete, @base_api_url + "/needs/100001/closed")
|
321
|
-
.with(body: fields.to_json)
|
322
|
-
.to_return(status: 204)
|
323
|
-
@api.reopen(100001, fields)
|
324
|
-
assert_requested reopen_stub
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
describe "creating notes" do
|
329
|
-
it "should send a post request" do
|
330
|
-
fields = {
|
331
|
-
"text" => "test",
|
332
|
-
"need_id" => "100001",
|
333
|
-
"author" => {
|
334
|
-
"name" => "Winston Smith-Churchill",
|
335
|
-
"email" => "winston@alphagov.co.uk"
|
336
|
-
}
|
337
|
-
}
|
338
|
-
request_stub = stub_create_note(fields)
|
339
|
-
|
340
|
-
@api.create_note(fields)
|
341
|
-
|
342
|
-
assert_requested(request_stub)
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|