conjur-api 6.0.1.pre.516 → 6.0.1.pre.517
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/VERSION +1 -1
- data/spec/unit/policy_load_result_spec.rb +102 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e9f6a1a2ae3a15512d4e762b04fd6edc58160ed123a82668f6fe56b4ea6ee5f
|
4
|
+
data.tar.gz: f2d0e12b634433d105d2d86847072bfcb2fdfdd90d49659cf70eb7a3ca07cf0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b32b4da3af930a235fb877eddf87c9e0fbbf68b92d5fe307a1a0450a33c496a0ea678efc5a1abe78de3752bc55716e32dd1c3d278e2d776825b5fcfd31508c5
|
7
|
+
data.tar.gz: '0796eef4b4d726b610cfebcddcd46baa8db23a55b3d9afed2b31f0e82f97375dc9b9b7f317c8ff882dfb81837e61b9b58d28b611ec7e71d08d04a3914dd77b7f'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.0.1-
|
1
|
+
6.0.1-517
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'conjur/policy_load_result'
|
3
|
+
|
4
|
+
# Tests the behavior of the Conjur::PolicyLoadResult class when parsing API responses.
|
5
|
+
describe Conjur::PolicyLoadResult do
|
6
|
+
let(:data) do
|
7
|
+
{
|
8
|
+
"created_roles" => {
|
9
|
+
"conjur:host:data/host-no-key" => {
|
10
|
+
"id" => "conjur:host:data/host-no-key",
|
11
|
+
"api_key" => nil
|
12
|
+
},
|
13
|
+
"conjur:host:data/host-with-key" => {
|
14
|
+
"id" => "conjur:host:data/host-with-key",
|
15
|
+
"api_key" => "12345"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"version" => 1
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
subject { described_class.new(data) }
|
23
|
+
|
24
|
+
describe "#created_roles" do
|
25
|
+
it "parses created roles with their API keys" do
|
26
|
+
created_roles = subject.created_roles
|
27
|
+
|
28
|
+
expect(created_roles).to include("conjur:host:data/host-no-key")
|
29
|
+
expect(created_roles["conjur:host:data/host-no-key"]["api_key"]).to be_nil
|
30
|
+
|
31
|
+
expect(created_roles).to include("conjur:host:data/host-with-key")
|
32
|
+
expect(created_roles["conjur:host:data/host-with-key"]["api_key"]).to eq("12345")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns nil if created_roles is missing" do
|
36
|
+
data.delete("created_roles")
|
37
|
+
expect(subject.created_roles).to be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it "returns an empty hash if created_roles is empty" do
|
41
|
+
data["created_roles"] = {}
|
42
|
+
expect(subject.created_roles).to eq({})
|
43
|
+
end
|
44
|
+
|
45
|
+
it "handles multiple roles with mixed api_key states, including null and missing keys" do
|
46
|
+
data["created_roles"] = {
|
47
|
+
"conjur:host:data/host-no-key" => {
|
48
|
+
"id" => "conjur:host:data/host-no-key",
|
49
|
+
"api_key" => nil
|
50
|
+
},
|
51
|
+
"conjur:host:data/host-with-key" => {
|
52
|
+
"id" => "conjur:host:data/host-with-key",
|
53
|
+
"api_key" => "valid_api_key"
|
54
|
+
},
|
55
|
+
"conjur:host:data/host-missing-key" => {
|
56
|
+
"id" => "conjur:host:data/host-missing-key"
|
57
|
+
},
|
58
|
+
"conjur:host:data/host-another-no-key" => {
|
59
|
+
"id" => "conjur:host:data/host-another-no-key",
|
60
|
+
"api_key" => nil
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
created_roles = subject.created_roles
|
65
|
+
|
66
|
+
# Check the role with a null API key
|
67
|
+
host_no_key = created_roles["conjur:host:data/host-no-key"]
|
68
|
+
expect(host_no_key).not_to be_nil
|
69
|
+
expect(host_no_key["id"]).to eq("conjur:host:data/host-no-key")
|
70
|
+
expect(host_no_key["api_key"]).to be_nil
|
71
|
+
|
72
|
+
# Check the role with a valid API key
|
73
|
+
host_with_key = created_roles["conjur:host:data/host-with-key"]
|
74
|
+
expect(host_with_key).not_to be_nil
|
75
|
+
expect(host_with_key["id"]).to eq("conjur:host:data/host-with-key")
|
76
|
+
expect(host_with_key["api_key"]).to eq("valid_api_key")
|
77
|
+
|
78
|
+
# Check the role with a missing API key field
|
79
|
+
host_missing_key = created_roles["conjur:host:data/host-missing-key"]
|
80
|
+
expect(host_missing_key).not_to be_nil
|
81
|
+
expect(host_missing_key["id"]).to eq("conjur:host:data/host-missing-key")
|
82
|
+
expect(host_missing_key["api_key"]).to be_nil
|
83
|
+
|
84
|
+
# Check another role with a null API key
|
85
|
+
another_no_key = created_roles["conjur:host:data/host-another-no-key"]
|
86
|
+
expect(another_no_key).not_to be_nil
|
87
|
+
expect(another_no_key["id"]).to eq("conjur:host:data/host-another-no-key")
|
88
|
+
expect(another_no_key["api_key"]).to be_nil
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "#version" do
|
93
|
+
it "parses the version of the policy" do
|
94
|
+
expect(subject.version).to eq(1)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "returns nil if version is missing" do
|
98
|
+
data.delete("version")
|
99
|
+
expect(subject.version).to be_nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
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: 6.0.1.pre.
|
4
|
+
version: 6.0.1.pre.517
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CyberArk Maintainers
|
@@ -403,6 +403,7 @@ files:
|
|
403
403
|
- spec/roles_spec.rb
|
404
404
|
- spec/spec_helper.rb
|
405
405
|
- spec/ssl_spec.rb
|
406
|
+
- spec/unit/policy_load_result_spec.rb
|
406
407
|
- spec/uri_escape_spec.rb
|
407
408
|
- test.sh
|
408
409
|
- tmp/.keep
|
@@ -474,4 +475,5 @@ test_files:
|
|
474
475
|
- spec/roles_spec.rb
|
475
476
|
- spec/spec_helper.rb
|
476
477
|
- spec/ssl_spec.rb
|
478
|
+
- spec/unit/policy_load_result_spec.rb
|
477
479
|
- spec/uri_escape_spec.rb
|