conjur-api 4.24.0 → 4.24.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: b6a400415b1a2ace3c70bfa63befe1155411e689
4
- data.tar.gz: da597b98f100670f494de01da0c7ec3e14f23164
3
+ metadata.gz: 5947d8b6da3129ef22780755b92550a5fbfd57b0
4
+ data.tar.gz: 0acd1390453eae96cb6040f0fa167c35f6aa732b
5
5
  SHA512:
6
- metadata.gz: 7cd91330ebb3ca97d512e639ee35256dd79723b55528fef64290e4d2c5c863048d4667598604e61145de22316045fe6a13a2a7bc5ba156819f7c440b52c0d3c1
7
- data.tar.gz: beb95a4206bf8ffed5d1bd8bee7a799d0d9984d7f7dffb729b3e29bb1832ed576e77c083e00988e0e6bb5e0e77e4e39a381cd360090946ba478fab9f7c12a579
6
+ metadata.gz: 92e2760b149238a95b86f1db50e59e21c04482cb8858581447fbe3edb9d12eb8ab60a5b72e628daa63908b116a37616052ce1a8d71e369d545c5989a8a5e869b
7
+ data.tar.gz: 5458008ccacf7c28e04de0d63ed00883e0df8120a06ac725816921ede7f6046936c069f14a72c8dfe4a88aa698ee202f69cf5ecbffc46a5913849cf4d871a00d
@@ -1,3 +1,7 @@
1
+ # v4.24.1
2
+
3
+ * Clarify the handling of the dry-run argument to `Conjur::API#ldap_sync_now`.
4
+
1
5
  # v4.24.0
2
6
 
3
7
  * Add `Conjur::API#ldap_sync_now` (requires Conjur 4.7 or later).
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Conjur
21
21
  class API
22
- VERSION = "4.24.0"
22
+ VERSION = "4.24.1"
23
23
  end
24
24
  end
@@ -33,7 +33,9 @@ module Conjur
33
33
  opts = credentials.dup.tap{ |h|
34
34
  h[:headers][:accept] = format
35
35
  }
36
-
36
+
37
+ dry_run = !!dry_run
38
+
37
39
  resp = RestClient::Resource.new(Conjur.configuration.appliance_url, opts)['ldap-sync']['sync'].post({
38
40
  config_name: config_name,
39
41
  dry_run: dry_run
@@ -4,23 +4,15 @@
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
6
6
  # the Software without restriction, including without limitation the rights to
7
- # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
- # the Software, and to permit persons to whom the Software is furnished to do so,
9
- # subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in all
12
- # copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
- # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
- # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
7
+
19
8
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
9
  #
21
10
  require 'spec_helper'
11
+ require 'helpers/request_helpers'
22
12
 
23
13
  describe Conjur::API, api: :dummy do
14
+ include RequestHelpers
15
+
24
16
  let(:appliance_url){ "http://example.com/api" }
25
17
  let(:ldapsync_url){ "#{appliance_url}/ldap-sync/sync" }
26
18
  let(:response_json){
@@ -34,21 +26,50 @@ describe Conjur::API, api: :dummy do
34
26
  }
35
27
  }
36
28
  let(:response){ double('response', body: response_json.to_json) }
29
+ let(:dry_run) { true }
37
30
 
38
31
  before do
39
32
  allow(Conjur.configuration).to receive(:appliance_url).and_return appliance_url
40
33
  allow(Conjur::API).to receive_messages(ldap_sync_now: ldapsync_url)
34
+ expect_request(
35
+ url: ldapsync_url,
36
+ method: :post,
37
+ headers: credentials[:headers],
38
+ payload: {config_name: 'default', dry_run: dry_run}
39
+ ).and_return response
41
40
  end
42
41
 
43
42
  describe "#ldap_sync_now" do
44
43
  it "POSTs /sync" do
45
- expect_request(
46
- url: ldapsync_url,
47
- method: :post,
48
- headers: credentials[:headers],
49
- payload: {config_name: 'default', dry_run: true}
50
- ).and_return response
51
44
  api.ldap_sync_now('default', 'application/json', true)
52
45
  end
53
46
  end
47
+
48
+ describe "#ldap_sync_now" do
49
+ let(:dry_run) { true }
50
+ it "POSTs /sync with dry_run set to true" do
51
+ api.ldap_sync_now('default', 'application/json', true)
52
+ end
53
+ end
54
+
55
+ describe "#ldap_sync_now" do
56
+ let(:dry_run) { false }
57
+ it "POSTs /sync with dry_run set to false" do
58
+ api.ldap_sync_now('default', 'application/json', false)
59
+ end
60
+ end
61
+
62
+ describe "#ldap_sync_now" do
63
+ let(:dry_run) { true }
64
+ it "POSTs /sync with truthy dry_run value" do
65
+ api.ldap_sync_now('default', 'application/json', 1)
66
+ end
67
+ end
68
+
69
+ describe "#ldap_sync_now" do
70
+ let(:dry_run) { false }
71
+ it "POSTs /sync with falsey dry_run value" do
72
+ api.ldap_sync_now('default', 'application/json', nil)
73
+ end
74
+ end
54
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.24.0
4
+ version: 4.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafal Rzepecki
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-24 00:00:00.000000000 Z
12
+ date: 2016-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client