wavefront-sdk 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +4 -1
- data/lib/wavefront-sdk/defs/version.rb +1 -1
- data/lib/wavefront-sdk/validators.rb +1 -5
- data/spec/wavefront-sdk/support/user_mixins_spec.rb +3 -3
- data/spec/wavefront-sdk/user_spec.rb +11 -10
- data/spec/wavefront-sdk/usergroup_spec.rb +1 -1
- data/spec/wavefront-sdk/validators_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 313adfc6845c757c8ce079ac7cc44a6a4a4979fe37204d3851d837af68496466
|
4
|
+
data.tar.gz: a797317ab7e0c00c10d6231ec3c6db552f973562cc4172b620c98bf6e47af02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e54e07151bf094132e03effce102428d40837605accfd03156426ecca98de7244f618f5fe191783dac6792ce8cf760f43252ea8e24b25c0d7f9b4fadced4e22f
|
7
|
+
data.tar.gz: 487f7dc0c1f06be5a3b743bb97f75ac8a3e6439625d9b46caba07801aa49a279ec8d8a7c0236442496fb1312279c3d6fa263478d58293a227f2c0f8f83a88049
|
data/HISTORY.md
CHANGED
@@ -386,11 +386,7 @@ module Wavefront
|
|
386
386
|
# @raise Wavefront::Exceptions::InvalidUserId if not valid
|
387
387
|
#
|
388
388
|
def wf_user_id?(user)
|
389
|
-
if user.is_a?(String) &&
|
390
|
-
user =~ /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
|
391
|
-
return true
|
392
|
-
end
|
393
|
-
|
389
|
+
return true if user.is_a?(String) && user.length < 256 && !user.empty?
|
394
390
|
raise Wavefront::Exception::InvalidUserId
|
395
391
|
end
|
396
392
|
|
@@ -15,11 +15,11 @@ class WavefrontUserMixinsTest < MiniTest::Test
|
|
15
15
|
assert validate_user_list(%w[u1@d1.net u2@d2.org u3@d3.com])
|
16
16
|
|
17
17
|
assert_raises(Wavefront::Exception::InvalidUserId) do
|
18
|
-
validate_user_list(
|
18
|
+
validate_user_list(['', 'u1d1.net', 'u2@d2.org', 'u3@d3.com'])
|
19
19
|
end
|
20
20
|
|
21
21
|
assert_raises(Wavefront::Exception::InvalidUserId) do
|
22
|
-
validate_user_list(
|
22
|
+
validate_user_list(['u1@d1.net', '', 'bbrg', 'u3@d3.com'])
|
23
23
|
end
|
24
24
|
|
25
25
|
assert_raises(ArgumentError) { validate_user_list('u1@d1.net') }
|
@@ -28,7 +28,7 @@ class WavefrontUserMixinsTest < MiniTest::Test
|
|
28
28
|
def validate_usergroup_list
|
29
29
|
assert_raises(Wavefront::Exception::InvalidUserGroupId) do
|
30
30
|
validate_user_list(%w[f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672
|
31
|
-
|
31
|
+
'',
|
32
32
|
2659191e-aad4-4302-a94e-9667e1517127])
|
33
33
|
end
|
34
34
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative '../spec_helper'
|
4
4
|
|
5
5
|
USER = 'user@example.com'.freeze
|
6
|
+
BAD_USER = ('user' * 500).freeze
|
6
7
|
PERMISSION = 'agent_management'.freeze
|
7
8
|
|
8
9
|
USER_BODY = { emailAddress: USER, groups: %w[browse] }.freeze
|
@@ -28,20 +29,20 @@ class WavefrontUserTest < WavefrontTestBase
|
|
28
29
|
|
29
30
|
def test_delete
|
30
31
|
should_work(:delete, USER, USER, :delete)
|
31
|
-
should_be_invalid(:delete,
|
32
|
+
should_be_invalid(:delete, BAD_USER)
|
32
33
|
assert_raises(ArgumentError) { wf.delete }
|
33
34
|
end
|
34
35
|
|
35
36
|
def test_describe
|
36
37
|
should_work(:describe, USER, USER)
|
37
|
-
should_be_invalid(:describe,
|
38
|
+
should_be_invalid(:describe, BAD_USER)
|
38
39
|
assert_raises(ArgumentError) { wf.describe }
|
39
40
|
end
|
40
41
|
|
41
42
|
def test_update
|
42
43
|
should_work(:update, [USER, USER_BODY, false], USER, :put,
|
43
44
|
JSON_POST_HEADERS, USER_BODY.to_json)
|
44
|
-
should_be_invalid(:update, [
|
45
|
+
should_be_invalid(:update, [BAD_USER, USER_BODY])
|
45
46
|
assert_raises(ArgumentError) { wf.update }
|
46
47
|
end
|
47
48
|
|
@@ -51,7 +52,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
51
52
|
JSON_POST_HEADERS, USERGROUP_LIST.to_json)
|
52
53
|
|
53
54
|
assert_raises(Wavefront::Exception::InvalidUserId) do
|
54
|
-
wf.add_groups_to_user(
|
55
|
+
wf.add_groups_to_user(BAD_USER, USERGROUP_LIST)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
@@ -61,7 +62,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
61
62
|
JSON_POST_HEADERS, USERGROUP_LIST.to_json)
|
62
63
|
|
63
64
|
assert_raises(Wavefront::Exception::InvalidUserId) do
|
64
|
-
wf.remove_groups_from_user(
|
65
|
+
wf.remove_groups_from_user(BAD_USER, USERGROUP_LIST)
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
@@ -71,7 +72,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
71
72
|
'Content-Type': 'application/x-www-form-urlencoded'
|
72
73
|
),
|
73
74
|
"group=#{PERMISSION}")
|
74
|
-
should_be_invalid(:grant, [
|
75
|
+
should_be_invalid(:grant, [BAD_USER, PERMISSION])
|
75
76
|
assert_raises(ArgumentError) { wf.grant }
|
76
77
|
end
|
77
78
|
|
@@ -81,7 +82,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
81
82
|
'Content-Type': 'application/x-www-form-urlencoded'
|
82
83
|
),
|
83
84
|
"group=#{PERMISSION}")
|
84
|
-
should_be_invalid(:revoke, [
|
85
|
+
should_be_invalid(:revoke, [BAD_USER, PERMISSION])
|
85
86
|
assert_raises(ArgumentError) { wf.revoke }
|
86
87
|
end
|
87
88
|
|
@@ -91,7 +92,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
91
92
|
[USER, 'other@example.com'].to_json)
|
92
93
|
|
93
94
|
assert_raises(Wavefront::Exception::InvalidUserId) do
|
94
|
-
wf.delete_users([
|
95
|
+
wf.delete_users([BAD_USER])
|
95
96
|
end
|
96
97
|
|
97
98
|
assert_raises(ArgumentError) { wf.delete_users('a@b.com') }
|
@@ -101,7 +102,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
101
102
|
should_work(:grant_permission, [PERMISSION, USER_LIST],
|
102
103
|
[:grant, PERMISSION].uri_concat, :post,
|
103
104
|
JSON_POST_HEADERS, USER_LIST.to_json)
|
104
|
-
should_be_invalid(:grant, [
|
105
|
+
should_be_invalid(:grant, [BAD_USER, PERMISSION])
|
105
106
|
assert_raises(ArgumentError) { wf.grant }
|
106
107
|
end
|
107
108
|
|
@@ -109,7 +110,7 @@ class WavefrontUserTest < WavefrontTestBase
|
|
109
110
|
should_work(:revoke_permission, [PERMISSION, USER_LIST],
|
110
111
|
[:revoke, PERMISSION].uri_concat, :post,
|
111
112
|
JSON_POST_HEADERS, USER_LIST.to_json)
|
112
|
-
should_be_invalid(:revoke, [
|
113
|
+
should_be_invalid(:revoke, [BAD_USER, PERMISSION])
|
113
114
|
assert_raises(ArgumentError) { wf.grant }
|
114
115
|
end
|
115
116
|
|
@@ -11,7 +11,7 @@ USERGROUP_BODY = { name: 'test group',
|
|
11
11
|
events_management] }.freeze
|
12
12
|
|
13
13
|
USER_LIST = %w[someone@somewhere.com other@elsewhere.net].freeze
|
14
|
-
BAD_USER_LIST =
|
14
|
+
BAD_USER_LIST = ['bad' * 500, ''].freeze
|
15
15
|
|
16
16
|
PERMISSION = 'alerts_management'.freeze
|
17
17
|
|
@@ -202,8 +202,8 @@ class WavefrontValidatorsTest < MiniTest::Test
|
|
202
202
|
|
203
203
|
def test_wf_user_id?
|
204
204
|
good = %w[Some.User@example.com general99+specific@somewhere.net
|
205
|
-
someone@somewhere.com]
|
206
|
-
bad =
|
205
|
+
someone@somewhere.com a user user-name]
|
206
|
+
bad = ['', [], {}, 'a' * 1000]
|
207
207
|
good_and_bad('wf_user_id?', 'InvalidUserId', good, bad)
|
208
208
|
end
|
209
209
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavefront-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|