gds-api-adapters 33.2.0 → 33.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3557af538323da5b11bc0f7cab83c990838837ed
4
- data.tar.gz: ce61e653825ad488bedf28631ac9b830eaaf6c00
3
+ metadata.gz: 1e954f66e624097dd778d14c8a52ce96df46b0f9
4
+ data.tar.gz: 0bec295878dca719388c0ff348a4cb752d7e39af
5
5
  SHA512:
6
- metadata.gz: f579fa8cfdfdaf6d8fd0b8fb2e9c19d03baa958dbe662d2e04de15cf0469e89e08a010f70205b15219bfc84038dca5660a811ecaa620ed935043aa6a53598268
7
- data.tar.gz: dc15adf200f8b9c77b738982fa87ed0ac6a8d0d7d5c5a97235bd35b6fcdb099b2daf92f2f27260cdb0131e84b4711ae8552f0ba6aa918ef59c81b043225db0be
6
+ metadata.gz: b4b22bfd35db7e5503f19885f7ec64f618c041ecf049b07a59c01ef16bc82d84828d6381699fe851012a1e1121519e6272c6f945ec6383aee99515b0d15651fe
7
+ data.tar.gz: bb98daf58ed027d1dabfc7fb7395acbd729f4ab6bddb13414fc20c558dca184e60296d8d0e44a07cdd166992845af02781a37b01aea60d310474ea5b8f8d8ea1
data/README.md CHANGED
@@ -12,9 +12,9 @@ results = rummager.unified_search(q: "taxes")
12
12
 
13
13
  Example adapters for frequently used applications:
14
14
 
15
- - [Publishing API](lib/gds_api/publishing_api_v2.rb) ([docs](http://www.rubydoc.info/github/alphagov/gds-api-adapters/master/GdsApi/PublishingApiV2), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/publishing_api_v2.rb), [test helper docs](http://www.rubydoc.info/github/alphagov/gds-api-adapters/master/GdsApi/TestHelpers/PublishingApiV2))
16
- - [Content Store](lib/gds_api/content_store.rb) ([docs](http://www.rubydoc.info/github/alphagov/gds-api-adapters/master/GdsApi/ContentStore), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/content_store.rb), [test helper docs](http://www.rubydoc.info/github/alphagov/gds-api-adapters/master/GdsApi/TestHelpers/ContentStore))
17
- - [Rummager](lib/gds_api/rummager.rb) ([docs](http://www.rubydoc.info/github/alphagov/gds-api-adapters/master/GdsApi/Rummager), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/rummager.rb), [test helper docs](http://www.rubydoc.info/github/alphagov/gds-api-adapters/master/GdsApi/TestHelpers/Rummager))
15
+ - [Publishing API](lib/gds_api/publishing_api_v2.rb) ([docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/PublishingApiV2), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/publishing_api_v2.rb), [test helper docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/TestHelpers/PublishingApiV2))
16
+ - [Content Store](lib/gds_api/content_store.rb) ([docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/ContentStore), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/content_store.rb), [test helper docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/TestHelpers/ContentStore))
17
+ - [Rummager](lib/gds_api/rummager.rb) ([docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/Rummager), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/rummager.rb), [test helper docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/TestHelpers/Rummager))
18
18
 
19
19
  ## Configuration
20
20
 
data/lib/gds_api/base.rb CHANGED
@@ -22,7 +22,7 @@ class GdsApi::Base
22
22
  :post_json, :post_json!,
23
23
  :put_json, :put_json!,
24
24
  :patch_json, :patch_json!,
25
- :delete_json, :delete_json!,
25
+ :delete_json, :delete_json!, :delete_json_with_params!,
26
26
  :get_raw, :get_raw!,
27
27
  :put_multipart,
28
28
  :post_multipart
@@ -54,12 +54,17 @@ module GdsApi
54
54
  def self.default_request_headers
55
55
  {
56
56
  'Accept' => 'application/json',
57
- 'Content-Type' => 'application/json',
58
57
  # GOVUK_APP_NAME is set for all apps by Puppet
59
58
  'User-Agent' => "gds-api-adapters/#{GdsApi::VERSION} (#{ENV["GOVUK_APP_NAME"]})"
60
59
  }
61
60
  end
62
61
 
62
+ def self.default_request_with_json_body_headers
63
+ self.default_request_headers.merge(
64
+ 'Content-Type' => 'application/json',
65
+ )
66
+ end
67
+
63
68
  DEFAULT_TIMEOUT_IN_SECONDS = 4
64
69
  DEFAULT_CACHE_SIZE = 100
65
70
  DEFAULT_CACHE_TTL = 15 * 60 # 15 minutes
@@ -69,8 +74,22 @@ module GdsApi
69
74
  end
70
75
 
71
76
  def get_raw(url)
72
- ignoring_missing do
77
+ if GdsApi.config.always_raise_for_not_found
73
78
  get_raw!(url)
79
+ else
80
+ warn <<-doc
81
+ DEPRECATION NOTICE: You are making requests that will potentially
82
+ return nil. Please set `GdsApi.config.always_raise_for_not_found = true`
83
+ to make sure all responses with 404 or 410 raise an exception.
84
+
85
+ Raising exceptions will be the default behaviour from October 1st, 2016.
86
+
87
+ Called from: #{caller[2]}
88
+ doc
89
+
90
+ ignoring_missing do
91
+ get_raw!(url)
92
+ end
74
93
  end
75
94
  end
76
95
 
@@ -118,7 +137,19 @@ module GdsApi
118
137
  do_json_request(:patch, url, params, additional_headers)
119
138
  end
120
139
 
121
- def delete_json!(url, params = nil, additional_headers = {})
140
+ def delete_json!(url, additional_headers = {})
141
+ do_json_request(:delete, url, nil, additional_headers)
142
+ end
143
+
144
+ def delete_json_with_params!(url, params, additional_headers = {})
145
+ warn <<-doc
146
+ DEPRECATION NOTICE: Delete requests should not include parameters.
147
+
148
+ Do not use this method as the ability to do this will be removed.
149
+
150
+ Called from: #{caller[2]}
151
+ doc
152
+
122
153
  do_json_request(:delete, url, params, additional_headers)
123
154
  end
124
155
 
@@ -195,10 +226,12 @@ module GdsApi
195
226
  )
196
227
  end
197
228
 
198
- def with_headers(method_params, headers)
199
- headers = headers.merge(GdsApi::GovukHeaders.headers)
229
+ def with_headers(method_params, default_headers, additional_headers)
200
230
  method_params.merge(
201
- headers: method_params[:headers].merge(headers)
231
+ headers: default_headers
232
+ .merge(method_params[:headers] || {})
233
+ .merge(GdsApi::GovukHeaders.headers)
234
+ .merge(additional_headers)
202
235
  )
203
236
  end
204
237
 
@@ -256,12 +289,19 @@ module GdsApi
256
289
  method_params = {
257
290
  method: method,
258
291
  url: url,
259
- headers: self.class.default_request_headers
260
292
  }
293
+
294
+ case method
295
+ when :get, :delete
296
+ default_headers = self.class.default_request_headers
297
+ else
298
+ default_headers = self.class.default_request_with_json_body_headers
299
+ end
300
+
261
301
  method_params[:payload] = params
262
- method_params = with_auth_options(method_params)
263
302
  method_params = with_timeout(method_params)
264
- method_params = with_headers(method_params, additional_headers)
303
+ method_params = with_headers(method_params, default_headers, additional_headers)
304
+ method_params = with_auth_options(method_params)
265
305
  if URI.parse(url).is_a? URI::HTTPS
266
306
  method_params = with_ssl_options(method_params)
267
307
  end
@@ -42,7 +42,8 @@ class GdsApi::NeedApi < GdsApi::Base
42
42
 
43
43
  def reopen(need_id, author)
44
44
  # author params: { "author" => { ... } }"
45
- delete_json!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", author)
45
+ # NB: This should really be a POST
46
+ delete_json_with_params!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", author)
46
47
  end
47
48
 
48
49
  def create_note(note)
@@ -2,10 +2,6 @@ require_relative 'base'
2
2
  require_relative 'part_methods'
3
3
 
4
4
  class GdsApi::Publisher < GdsApi::Base
5
- def reindex_topic_editions(slug)
6
- post_json!("#{endpoint}/api/reindex-topic-editions/#{slug}")
7
- end
8
-
9
5
  def publication_for_slug(slug, options = {})
10
6
  return nil if slug.nil? or slug == ''
11
7
 
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '33.2.0'
2
+ VERSION = '33.2.1'
3
3
  end
@@ -15,6 +15,8 @@ class JsonClientTest < MiniTest::Spec
15
15
  GdsApi::JsonClient.cache = nil
16
16
 
17
17
  @client = GdsApi::JsonClient.new
18
+
19
+ WebMock.disable_net_connect!
18
20
  end
19
21
 
20
22
  def teardown
@@ -382,16 +384,124 @@ class JsonClientTest < MiniTest::Spec
382
384
  end
383
385
  end
384
386
 
385
- def test_get_should_be_nil_if_404_returned_from_endpoint
387
+ def test_get_should_be_nil_if_404_returned_from_endpoint_and_always_raise_for_not_found_is_disabled
388
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
389
+ GdsApi.configure do |config|
390
+ config.always_raise_for_not_found = false
391
+ end
386
392
  url = "http://some.endpoint/some.json"
387
393
  stub_request(:get, url).to_return(:body => "{}", :status => 404)
388
394
  assert_nil @client.get_json(url)
395
+ ensure
396
+ GdsApi.configure do |config|
397
+ config.always_raise_for_not_found = @old_always_raise
398
+ end
389
399
  end
390
400
 
391
- def test_get_should_be_nil_if_410_returned_from_endpoint
401
+ def test_get_should_be_nil_if_410_returned_from_endpoint_and_always_raise_for_not_found_is_disabled
402
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
403
+ GdsApi.configure do |config|
404
+ config.always_raise_for_not_found = false
405
+ end
392
406
  url = "http://some.endpoint/some.json"
393
407
  stub_request(:get, url).to_return(:body => "{}", :status => 410)
394
408
  assert_nil @client.get_json(url)
409
+ ensure
410
+ GdsApi.configure do |config|
411
+ config.always_raise_for_not_found = @old_always_raise
412
+ end
413
+ end
414
+
415
+ def test_get_should_be_nil_if_404_returned_from_endpoint_and_always_raise_for_not_found_is_enabled
416
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
417
+ GdsApi.configure do |config|
418
+ config.always_raise_for_not_found = true
419
+ end
420
+ url = "http://some.endpoint/some.json"
421
+ stub_request(:get, url).to_return(:body => "{}", :status => 404)
422
+ assert_raises GdsApi::HTTPNotFound do
423
+ @client.get_json(url)
424
+ end
425
+ ensure
426
+ GdsApi.configure do |config|
427
+ config.always_raise_for_not_found = @old_always_raise
428
+ end
429
+ end
430
+
431
+ def test_get_should_be_nil_if_410_returned_from_endpoint_and_always_raise_for_not_found_is_enabled
432
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
433
+ GdsApi.configure do |config|
434
+ config.always_raise_for_not_found = true
435
+ end
436
+ url = "http://some.endpoint/some.json"
437
+ stub_request(:get, url).to_return(:body => "{}", :status => 410)
438
+ assert_raises GdsApi::HTTPGone do
439
+ @client.get_json(url)
440
+ end
441
+ ensure
442
+ GdsApi.configure do |config|
443
+ config.always_raise_for_not_found = @old_always_raise
444
+ end
445
+ end
446
+
447
+ def test_get_raw_should_be_nil_if_404_returned_from_endpoint_and_always_raise_for_not_found_is_disabled
448
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
449
+ GdsApi.configure do |config|
450
+ config.always_raise_for_not_found = false
451
+ end
452
+ url = "http://some.endpoint/some.json"
453
+ stub_request(:get, url).to_return(:body => "{}", :status => 404)
454
+ assert_nil @client.get_raw(url)
455
+ ensure
456
+ GdsApi.configure do |config|
457
+ config.always_raise_for_not_found = @old_always_raise
458
+ end
459
+ end
460
+
461
+ def test_get_raw_should_be_nil_if_410_returned_from_endpoint_and_always_raise_for_not_found_is_disabled
462
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
463
+ GdsApi.configure do |config|
464
+ config.always_raise_for_not_found = false
465
+ end
466
+ url = "http://some.endpoint/some.json"
467
+ stub_request(:get, url).to_return(:body => "{}", :status => 410)
468
+ assert_nil @client.get_raw(url)
469
+ ensure
470
+ GdsApi.configure do |config|
471
+ config.always_raise_for_not_found = @old_always_raise
472
+ end
473
+ end
474
+
475
+ def test_get_raw_should_be_nil_if_404_returned_from_endpoint_and_always_raise_for_not_found_is_enabled
476
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
477
+ GdsApi.configure do |config|
478
+ config.always_raise_for_not_found = true
479
+ end
480
+ url = "http://some.endpoint/some.json"
481
+ stub_request(:get, url).to_return(:body => "{}", :status => 404)
482
+ assert_raises GdsApi::HTTPNotFound do
483
+ @client.get_raw(url)
484
+ end
485
+ ensure
486
+ GdsApi.configure do |config|
487
+ config.always_raise_for_not_found = @old_always_raise
488
+ end
489
+ end
490
+
491
+ def test_get_raw_should_be_nil_if_410_returned_from_endpoint_and_always_raise_for_not_found_is_enabled
492
+ @old_always_raise = GdsApi.config.always_raise_for_not_found
493
+ GdsApi.configure do |config|
494
+ config.always_raise_for_not_found = true
495
+ end
496
+ url = "http://some.endpoint/some.json"
497
+ stub_request(:get, url).to_return(:body => "{}", :status => 410)
498
+ assert_raises GdsApi::HTTPGone do
499
+ @client.get_raw(url)
500
+ end
501
+ ensure
502
+ GdsApi.configure do |config|
503
+ config.always_raise_for_not_found = @old_always_raise
504
+ end
395
505
  end
396
506
 
397
507
  def test_get_should_raise_error_if_non_404_non_410_error_code_returned_from_endpoint
@@ -402,7 +512,7 @@ class JsonClientTest < MiniTest::Spec
402
512
  end
403
513
  end
404
514
 
405
- def test_get_should_raise_conflict_for_410
515
+ def test_get_should_raise_conflict_for_409
406
516
  url = "http://some.endpoint/some.json"
407
517
  stub_request(:delete, url).to_return(:body => "{}", :status => 409)
408
518
  assert_raises GdsApi::HTTPConflict do
@@ -662,7 +772,7 @@ class JsonClientTest < MiniTest::Spec
662
772
 
663
773
  def test_client_can_use_bearer_token
664
774
  client = GdsApi::JsonClient.new(bearer_token: 'SOME_BEARER_TOKEN')
665
- expected_headers = GdsApi::JsonClient.default_request_headers.
775
+ expected_headers = GdsApi::JsonClient.default_request_with_json_body_headers.
666
776
  merge('Authorization' => 'Bearer SOME_BEARER_TOKEN')
667
777
 
668
778
  stub_request(:put, "http://some.other.endpoint/some.json").
@@ -712,7 +822,7 @@ class JsonClientTest < MiniTest::Spec
712
822
  def test_client_can_set_custom_headers_on_deletes
713
823
  stub_request(:delete, "http://some.other.endpoint/some.json").to_return(:status => 200)
714
824
 
715
- response = GdsApi::JsonClient.new.delete_json("http://some.other.endpoint/some.json", {},
825
+ response = GdsApi::JsonClient.new.delete_json("http://some.other.endpoint/some.json",
716
826
  { "HEADER-A" => "B", "HEADER-C" => "D" })
717
827
 
718
828
  assert_requested(:delete, %r{/some.json}) do |request|
@@ -862,4 +972,21 @@ class JsonClientTest < MiniTest::Spec
862
972
  client = GdsApi::JsonClient.new(logger: custom_logger)
863
973
  assert_same client.logger, custom_logger
864
974
  end
975
+
976
+ def test_should_avoid_content_type_header_on_get_without_body
977
+ url = "http://some.endpoint/some.json"
978
+ stub_request(:any, url)
979
+
980
+ @client.get_json!(url)
981
+ assert_requested(:get, url, headers: GdsApi::JsonClient.default_request_headers)
982
+
983
+ @client.delete_json!(url)
984
+ assert_requested(:delete, url, headers: GdsApi::JsonClient.default_request_headers)
985
+
986
+ @client.post_json!(url, test: "123")
987
+ assert_requested(:post, url, headers: GdsApi::JsonClient.default_request_with_json_body_headers)
988
+
989
+ @client.put_json!(url, test: "123")
990
+ assert_requested(:put, url, headers: GdsApi::JsonClient.default_request_with_json_body_headers)
991
+ end
865
992
  end
@@ -106,13 +106,4 @@ describe GdsApi::Publisher do
106
106
  to_return(:status => 200, :body => '{"snac": "12345"}', :headers => {})
107
107
  assert_equal '12345', api.council_for_slug('fake-transaction', [12345])
108
108
  end
109
-
110
- describe "#reindex_topic_editions(slug)" do
111
- it "posts to the reindex URL" do
112
- api.expects(:post_json!)
113
- .with("#{PUBLISHER_ENDPOINT}/api/reindex-topic-editions/oil-and-gas/licensing")
114
-
115
- api.reindex_topic_editions("oil-and-gas/licensing")
116
- end
117
- end
118
109
  end
@@ -1121,9 +1121,7 @@ describe GdsApi::PublishingApiV2 do
1121
1121
  method: :get,
1122
1122
  path: "/v2/linkables",
1123
1123
  query: "document_type=topic",
1124
- headers: {
1125
- "Content-Type" => "application/json",
1126
- },
1124
+ headers: {},
1127
1125
  )
1128
1126
  .will_respond_with(
1129
1127
  status: 200,
@@ -1150,9 +1148,7 @@ describe GdsApi::PublishingApiV2 do
1150
1148
  method: :get,
1151
1149
  path: "/v2/content",
1152
1150
  query: "content_format=topic&fields%5B%5D=title&fields%5B%5D=base_path",
1153
- headers: {
1154
- "Content-Type" => "application/json",
1155
- },
1151
+ headers: {},
1156
1152
  )
1157
1153
  .will_respond_with(
1158
1154
  status: 200,
@@ -1196,9 +1192,7 @@ describe GdsApi::PublishingApiV2 do
1196
1192
  method: :get,
1197
1193
  path: "/v2/content",
1198
1194
  query: "content_format=topic&fields%5B%5D=content_id&fields%5B%5D=locale",
1199
- headers: {
1200
- "Content-Type" => "application/json",
1201
- },
1195
+ headers: {},
1202
1196
  )
1203
1197
  .will_respond_with(
1204
1198
  status: 200,
@@ -1240,9 +1234,7 @@ describe GdsApi::PublishingApiV2 do
1240
1234
  method: :get,
1241
1235
  path: "/v2/content",
1242
1236
  query: "content_format=topic&fields%5B%5D=content_id&fields%5B%5D=locale&locale=fr",
1243
- headers: {
1244
- "Content-Type" => "application/json",
1245
- },
1237
+ headers: {},
1246
1238
  )
1247
1239
  .will_respond_with(
1248
1240
  status: 200,
@@ -1284,9 +1276,7 @@ describe GdsApi::PublishingApiV2 do
1284
1276
  method: :get,
1285
1277
  path: "/v2/content",
1286
1278
  query: "content_format=topic&fields%5B%5D=content_id&fields%5B%5D=locale&locale=all",
1287
- headers: {
1288
- "Content-Type" => "application/json",
1289
- },
1279
+ headers: {},
1290
1280
  )
1291
1281
  .will_respond_with(
1292
1282
  status: 200,
@@ -1333,9 +1323,7 @@ describe GdsApi::PublishingApiV2 do
1333
1323
  method: :get,
1334
1324
  path: "/v2/content",
1335
1325
  query: "content_format=topic&fields%5B%5D=content_id&fields%5B%5D=details",
1336
- headers: {
1337
- "Content-Type" => "application/json",
1338
- },
1326
+ headers: {},
1339
1327
  )
1340
1328
  .will_respond_with(
1341
1329
  status: 200,
@@ -1509,9 +1497,7 @@ describe GdsApi::PublishingApiV2 do
1509
1497
  method: :get,
1510
1498
  path: "/v2/linked/" + @linked_content_item['content_id'],
1511
1499
  query: "fields%5B%5D=content_id&fields%5B%5D=base_path&link_type=topic",
1512
- headers: {
1513
- "Content-Type" => "application/json",
1514
- },
1500
+ headers: {},
1515
1501
  )
1516
1502
  .will_respond_with(
1517
1503
  status: 200,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 33.2.0
4
+ version: 33.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -397,7 +397,6 @@ files:
397
397
  - lib/gds_api/test_helpers/whitehall_admin_api.rb
398
398
  - lib/gds_api/test_helpers/worldwide.rb
399
399
  - lib/gds_api/version.rb
400
- - lib/gds_api/whitehall_admin_api.rb
401
400
  - lib/gds_api/worldwide.rb
402
401
  - test/asset_manager_test.rb
403
402
  - test/business_support_api_test.rb
@@ -449,7 +448,6 @@ files:
449
448
  - test/test_helpers/panopticon_test.rb
450
449
  - test/test_helpers/publishing_api_test.rb
451
450
  - test/test_helpers/publishing_api_v2_test.rb
452
- - test/whitehall_admin_api_test.rb
453
451
  - test/worldwide_api_test.rb
454
452
  homepage: http://github.com/alphagov/gds-api-adapters
455
453
  licenses: []
@@ -526,5 +524,4 @@ test_files:
526
524
  - test/publishing_api_v2_test.rb
527
525
  - test/rummager_test.rb
528
526
  - test/mapit_test.rb
529
- - test/whitehall_admin_api_test.rb
530
527
  has_rdoc:
@@ -1,13 +0,0 @@
1
- require_relative 'base'
2
-
3
- class GdsApi::WhitehallAdminApi < GdsApi::Base
4
- def reindex_specialist_sector_editions(slug)
5
- post_json!("#{endpoint}/reindex-specialist-sector-editions/#{slug}")
6
- end
7
-
8
- private
9
-
10
- def endpoint
11
- "#{super}/government/admin/api"
12
- end
13
- end
@@ -1,18 +0,0 @@
1
- require 'test_helper'
2
- require 'gds_api/whitehall_admin_api'
3
-
4
- describe GdsApi::WhitehallAdminApi do
5
-
6
- before do
7
- @api = GdsApi::WhitehallAdminApi.new("http://whitehall-admin.example.com")
8
- end
9
-
10
- describe "#reindex_specialist_sector_editions(slug)" do
11
- it "posts to the reindex URL" do
12
- @api.expects(:post_json!)
13
- .with("http://whitehall-admin.example.com/government/admin/api/reindex-specialist-sector-editions/oil-and-gas/licensing")
14
-
15
- @api.reindex_specialist_sector_editions("oil-and-gas/licensing")
16
- end
17
- end
18
- end