wavefront-sdk 3.0.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +12 -1
  3. data/README.md +4 -0
  4. data/Rakefile +1 -0
  5. data/lib/wavefront-sdk/alert.rb +36 -49
  6. data/lib/wavefront-sdk/api_mixins/acl.rb +76 -0
  7. data/lib/wavefront-sdk/api_mixins/tag.rb +62 -0
  8. data/lib/wavefront-sdk/api_mixins/user.rb +26 -0
  9. data/lib/wavefront-sdk/apitoken.rb +49 -0
  10. data/lib/wavefront-sdk/core/exception.rb +1 -0
  11. data/lib/wavefront-sdk/dashboard.rb +6 -106
  12. data/lib/wavefront-sdk/defs/version.rb +1 -1
  13. data/lib/wavefront-sdk/derivedmetric.rb +6 -56
  14. data/lib/wavefront-sdk/event.rb +4 -50
  15. data/lib/wavefront-sdk/paginator/base.rb +8 -7
  16. data/lib/wavefront-sdk/paginator/post.rb +7 -5
  17. data/lib/wavefront-sdk/source.rb +4 -48
  18. data/lib/wavefront-sdk/user.rb +2 -2
  19. data/lib/wavefront-sdk/usergroup.rb +2 -2
  20. data/lib/wavefront-sdk/validators.rb +10 -0
  21. data/lib/wavefront-sdk/write.rb +43 -12
  22. data/lib/wavefront-sdk/writers/socket.rb +2 -2
  23. data/spec/.rubocop.yml +1 -1
  24. data/spec/spec_helper.rb +66 -0
  25. data/spec/wavefront-sdk/alert_spec.rb +14 -0
  26. data/spec/wavefront-sdk/{support → api_mixins}/user_mixins_spec.rb +2 -2
  27. data/spec/wavefront-sdk/apitoken_spec.rb +31 -0
  28. data/spec/wavefront-sdk/core/api_spec.rb +3 -5
  29. data/spec/wavefront-sdk/credentials_spec.rb +41 -37
  30. data/spec/wavefront-sdk/dashboard_spec.rb +4 -52
  31. data/spec/wavefront-sdk/distribution_spec.rb +1 -3
  32. data/spec/wavefront-sdk/metric_helper_spec.rb +6 -8
  33. data/spec/wavefront-sdk/report_spec.rb +2 -2
  34. data/spec/wavefront-sdk/stdlib/array_spec.rb +6 -6
  35. data/spec/wavefront-sdk/stdlib/hash_spec.rb +5 -5
  36. data/spec/wavefront-sdk/support/mixins_spec.rb +34 -36
  37. data/spec/wavefront-sdk/support/parse_time_spec.rb +25 -29
  38. data/spec/wavefront-sdk/usergroup_spec.rb +34 -34
  39. data/spec/wavefront-sdk/validators_spec.rb +10 -1
  40. data/spec/wavefront-sdk/write_spec.rb +71 -4
  41. data/spec/wavefront-sdk/writers/core_spec.rb +10 -10
  42. data/spec/wavefront-sdk/writers/socket_spec.rb +13 -1
  43. metadata +10 -5
  44. data/lib/wavefront-sdk/support/user_mixins.rb +0 -24
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ SimpleCov.start do
7
7
  add_filter '/spec/'
8
8
  end
9
9
  require 'minitest/autorun'
10
+ require 'spy/integration'
10
11
  require 'webmock/minitest'
11
12
 
12
13
  # rubocop:disable Style/MutableConstant
@@ -14,6 +15,8 @@ CREDS = { endpoint: 'test.example.com',
14
15
  token: '0123456789-ABCDEF' }
15
16
  # rubocop:enable Style/MutableConstant
16
17
 
18
+ W_CREDS = { proxy: 'wavefront', port: 2878 }.freeze
19
+
17
20
  POST_HEADERS = {
18
21
  'Content-Type': 'text/plain', Accept: 'application/json'
19
22
  }.freeze
@@ -29,6 +32,11 @@ DUMMY_RESPONSE = '{"status":{"result":"OK","message":"","code":200},' \
29
32
  RESOURCE_DIR = (Pathname.new(__FILE__).dirname +
30
33
  'wavefront-sdk' + 'resources').freeze
31
34
 
35
+ U_ACL_1 = { name: 'someone@example.com', id: 'someone@example.com' }.freeze
36
+ U_ACL_2 = { name: 'other@elsewhere.com', id: 'other@elsewhere.com' }.freeze
37
+ GRP_ACL = { name: 'example group',
38
+ id: 'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672' }.freeze
39
+
32
40
  # Common testing code
33
41
  class WavefrontTestBase < MiniTest::Test
34
42
  attr_reader :wf, :wf_noop, :headers
@@ -160,6 +168,48 @@ class WavefrontTestBase < MiniTest::Test
160
168
  wf.send(method, id, '<!!!>')
161
169
  end
162
170
  end
171
+
172
+ def acl_tester(id)
173
+ id2 = id.reverse
174
+ should_work(:acls, [[id, id2]], "acl?id=#{id}&id=#{id2}")
175
+
176
+ should_work(:acl_add, [id, [U_ACL_1, U_ACL_2], [GRP_ACL]],
177
+ 'acl/add', :post, {}, acl_body(id,
178
+ [U_ACL_1, U_ACL_2],
179
+ [GRP_ACL]))
180
+
181
+ should_work(:acl_add, [id, [U_ACL_1, U_ACL_2]],
182
+ 'acl/add', :post, {}, acl_body(id,
183
+ [U_ACL_1, U_ACL_2]))
184
+ assert_raises(ArgumentError) { wf.acl_add(id, U_ACL_1) }
185
+ assert_raises(ArgumentError) { wf.acl_add(id, [U_ACL_1], GRP_ACL) }
186
+
187
+ should_work(:acl_delete, [id, [U_ACL_1, U_ACL_2], [GRP_ACL]],
188
+ 'acl/remove', :post, {}, acl_body(id,
189
+ [U_ACL_1, U_ACL_2],
190
+ [GRP_ACL]))
191
+
192
+ should_work(:acl_delete, [id, [U_ACL_1, U_ACL_2]],
193
+ 'acl/remove', :post, {}, acl_body(id,
194
+ [U_ACL_1, U_ACL_2]))
195
+ assert_raises(ArgumentError) { wf.acl_delete(id, U_ACL_1) }
196
+
197
+ should_work(:acl_set, [id, [U_ACL_1, U_ACL_2], [GRP_ACL]],
198
+ 'acl/set', :put, {}, acl_body(id,
199
+ [U_ACL_1, U_ACL_2],
200
+ [GRP_ACL]))
201
+
202
+ should_work(:acl_set, [id, [U_ACL_1, U_ACL_2]],
203
+ 'acl/set', :put, {}, acl_body(id,
204
+ [U_ACL_1, U_ACL_2]))
205
+ assert_raises(ArgumentError) { wf.acl_set(id, U_ACL_1) }
206
+ end
207
+
208
+ # used by acl_tester
209
+ #
210
+ def acl_body(id, view = [], modify = [])
211
+ [{ entityId: id, viewAcl: view, modifyAcl: modify }].to_json
212
+ end
163
213
  end
164
214
 
165
215
  # Extensions to stdlib
@@ -182,6 +232,14 @@ class Mocket
182
232
  def ok?
183
233
  true
184
234
  end
235
+
236
+ def response
237
+ { sent: 1, rejected: 0, unsent: 0 }
238
+ end
239
+
240
+ def status
241
+ { result: 'OK', message: nil, code: nil }
242
+ end
185
243
  end
186
244
 
187
245
  # A mock socket which says things went wrong.
@@ -190,4 +248,12 @@ class BadMocket < Mocket
190
248
  def ok?
191
249
  false
192
250
  end
251
+
252
+ def status
253
+ { result: 'ERROR', message: nil, code: nil }
254
+ end
255
+
256
+ def response
257
+ { sent: 0, rejected: 1, unsent: 0 }
258
+ end
193
259
  end
@@ -55,6 +55,16 @@ class WavefrontAlertTest < WavefrontTestBase
55
55
  assert_raises(ArgumentError) { wf.create('test') }
56
56
  end
57
57
 
58
+ def test_clone
59
+ should_work(:clone, [ALERT], [ALERT, :clone].uri_concat,
60
+ :post, JSON_POST_HEADERS,
61
+ { id: ALERT, name: nil, v: nil }.to_json)
62
+ should_work(:clone, [ALERT, 4], [ALERT, :clone].uri_concat,
63
+ :post, JSON_POST_HEADERS,
64
+ { id: ALERT, name: nil, v: 4 }.to_json)
65
+ assert_raises(ArgumentError) { wf.clone }
66
+ end
67
+
58
68
  def test_describe_v
59
69
  should_work(:describe, [ALERT, 4], "#{ALERT}/history/4")
60
70
  end
@@ -92,6 +102,10 @@ class WavefrontAlertTest < WavefrontTestBase
92
102
  tag_tester(ALERT)
93
103
  end
94
104
 
105
+ def test_acls
106
+ acl_tester(ALERT)
107
+ end
108
+
95
109
  def test_undelete
96
110
  should_work(:undelete, ALERT, ["#{ALERT}/undelete", nil], :post,
97
111
  POST_HEADERS)
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require_relative '../../spec_helper'
4
- require_relative '../../../lib/wavefront-sdk/support/user_mixins'
4
+ require_relative '../../../lib/wavefront-sdk/api_mixins/user'
5
5
  require_relative '../../../lib/wavefront-sdk/validators'
6
6
  require_relative '../../../lib/wavefront-sdk/core/exception'
7
7
 
8
8
  # Test user mixins
9
9
  #
10
10
  class WavefrontUserMixinsTest < MiniTest::Test
11
- include Wavefront::UserMixins
11
+ include Wavefront::Mixin::User
12
12
  include Wavefront::Validators
13
13
 
14
14
  def test_validate_user_list
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../spec_helper'
4
+
5
+ API_TOKEN_ID = '17db4cc1-65f6-40a8-a1fa-6fcae460c4bd'.freeze
6
+
7
+ # Unit tests for API token class
8
+ #
9
+ class WavefrontApiTokenTest < WavefrontTestBase
10
+ def test_list
11
+ should_work(:list, [], '')
12
+ end
13
+
14
+ def test_create
15
+ should_work(:create, [], '', :post, JSON_POST_HEADERS, nil)
16
+ assert_raises(ArgumentError) { wf.create('test') }
17
+ end
18
+
19
+ def test_delete
20
+ should_work(:delete, API_TOKEN_ID, API_TOKEN_ID, :delete)
21
+ should_be_invalid(:delete)
22
+ end
23
+
24
+ def test_rename
25
+ should_work(:rename, [API_TOKEN_ID, 'token name'],
26
+ API_TOKEN_ID, :put, JSON_POST_HEADERS,
27
+ { tokenID: API_TOKEN_ID, tokenName: 'token name' }.to_json)
28
+ should_be_invalid(:rename, ['!invalid token!', 'token name'])
29
+ assert_raises(ArgumentError) { wf.rename }
30
+ end
31
+ end
@@ -3,7 +3,6 @@
3
3
  require_relative '../../spec_helper'
4
4
  require_relative '../../../lib/wavefront-sdk/core/api'
5
5
 
6
- #
7
6
  # Test SDK core API class
8
7
  #
9
8
  class WavefrontCoreApiTest < MiniTest::Test
@@ -15,8 +14,8 @@ class WavefrontCoreApiTest < MiniTest::Test
15
14
 
16
15
  def test_time_to_ms
17
16
  now_ms = Time.now.to_i * 1000
18
- assert_equal wf.time_to_ms(now_ms), now_ms
19
- assert_equal wf.time_to_ms(1_469_711_187), 1_469_711_187_000
17
+ assert_equal(now_ms, wf.time_to_ms(now_ms))
18
+ assert_equal(1_469_711_187_000, wf.time_to_ms(1_469_711_187))
20
19
  refute wf.time_to_ms([])
21
20
  refute wf.time_to_ms('1469711187')
22
21
  end
@@ -25,7 +24,6 @@ class WavefrontCoreApiTest < MiniTest::Test
25
24
  wf.instance_variable_set('@update_keys', %i[k1 k2])
26
25
  body = { k1: 'ov1', k2: 'ov2', k3: 'ov3' }
27
26
  upd = { k2: 'nv1' }
28
-
29
- assert_equal(wf.hash_for_update(body, upd), k1: 'ov1', k2: 'nv1')
27
+ assert_equal({ k1: 'ov1', k2: 'nv1' }, wf.hash_for_update(body, upd))
30
28
  end
31
29
  end
@@ -4,8 +4,6 @@ require 'pathname'
4
4
  require_relative '../spec_helper'
5
5
  require_relative '../../lib/wavefront-sdk/credentials'
6
6
 
7
- p RESOURCE_DIR
8
-
9
7
  CONF1 = RESOURCE_DIR + 'test.conf'
10
8
  CONF2 = RESOURCE_DIR + 'test2.conf'
11
9
 
@@ -22,9 +20,9 @@ class WavefrontCredentialsTest < MiniTest::Test
22
20
  assert_instance_of(Map, c.config)
23
21
  assert_instance_of(Map, c.all)
24
22
 
25
- assert_equal(c.creds.keys, %w[token endpoint])
26
- assert_equal(c.creds[:token], '12345678-abcd-1234-abcd-123456789012')
27
- assert_equal(c.creds[:endpoint], 'default.wavefront.com')
23
+ assert_equal(%w[token endpoint], c.creds.keys)
24
+ assert_equal('12345678-abcd-1234-abcd-123456789012', c.creds[:token])
25
+ assert_equal('default.wavefront.com', c.creds[:endpoint])
28
26
  end
29
27
 
30
28
  def test_initialize_env_token
@@ -37,9 +35,9 @@ class WavefrontCredentialsTest < MiniTest::Test
37
35
  assert_instance_of(Map, c.config)
38
36
  assert_instance_of(Map, c.all)
39
37
 
40
- assert_equal(c.creds.keys, %w[token endpoint])
41
- assert_equal(c.creds[:token], 'abcdefgh')
42
- assert_equal(c.creds[:endpoint], 'default.wavefront.com')
38
+ assert_equal(%w[token endpoint], c.creds.keys)
39
+ assert_equal('abcdefgh', c.creds[:token])
40
+ assert_equal('default.wavefront.com', c.creds[:endpoint])
43
41
  end
44
42
 
45
43
  def test_initialize_env_endpoint
@@ -52,9 +50,9 @@ class WavefrontCredentialsTest < MiniTest::Test
52
50
  assert_instance_of(Map, c.config)
53
51
  assert_instance_of(Map, c.all)
54
52
 
55
- assert_equal(c.creds.keys, %w[token endpoint])
56
- assert_equal(c.creds[:token], '12345678-abcd-1234-abcd-123456789012')
57
- assert_equal(c.creds[:endpoint], 'endpoint.wavefront.com')
53
+ assert_equal(%w[token endpoint], c.creds.keys)
54
+ assert_equal('12345678-abcd-1234-abcd-123456789012', c.creds[:token])
55
+ assert_equal('endpoint.wavefront.com', c.creds[:endpoint])
58
56
  end
59
57
  end
60
58
 
@@ -83,22 +81,26 @@ class GibletsTest < MiniTest::Test
83
81
  end
84
82
 
85
83
  def test_env_override_noenvs
86
- assert_equal(wf.env_override(raw), raw)
84
+ assert_equal(raw, wf.env_override(raw))
87
85
  end
88
86
 
89
87
  def test_env_override_env_endpoint
90
88
  ENV['WAVEFRONT_ENDPOINT'] = 'env_ep'
91
89
 
92
- assert_equal(wf.env_override(raw),
93
- endpoint: 'env_ep', token: 'raw_tok', proxy: 'raw_proxy')
90
+ assert_equal(
91
+ { endpoint: 'env_ep', token: 'raw_tok', proxy: 'raw_proxy' },
92
+ wf.env_override(raw)
93
+ )
94
94
  end
95
95
 
96
96
  def test_env_override_env_endpoint_and_token
97
97
  ENV['WAVEFRONT_ENDPOINT'] = 'env_ep'
98
98
  ENV['WAVEFRONT_TOKEN'] = 'env_tok'
99
99
 
100
- assert_equal(wf.env_override(raw),
101
- endpoint: 'env_ep', token: 'env_tok', proxy: 'raw_proxy')
100
+ assert_equal(
101
+ { endpoint: 'env_ep', token: 'env_tok', proxy: 'raw_proxy' },
102
+ wf.env_override(raw)
103
+ )
102
104
  end
103
105
 
104
106
  def test_env_override_env_proxy
@@ -106,8 +108,10 @@ class GibletsTest < MiniTest::Test
106
108
  x = wf.env_override(raw)
107
109
 
108
110
  assert_instance_of(Hash, x)
109
- assert_equal(x, endpoint: 'raw_ep', token: 'raw_tok', proxy:
110
- 'env_proxy')
111
+ assert_equal(
112
+ { endpoint: 'raw_ep', token: 'raw_tok', proxy: 'env_proxy' },
113
+ x
114
+ )
111
115
  end
112
116
 
113
117
  def test_populate
@@ -117,23 +121,23 @@ class GibletsTest < MiniTest::Test
117
121
  proxy = wf.instance_variable_get('@proxy')
118
122
 
119
123
  assert_instance_of(Map, config)
120
- assert_equal(config.proxy, 'raw_proxy')
121
- assert_equal(config.endpoint, 'raw_ep')
124
+ assert_equal('raw_proxy', config.proxy)
125
+ assert_equal('raw_ep', config.endpoint)
122
126
 
123
127
  assert_instance_of(Map, creds)
124
- assert_equal(creds.endpoint, 'raw_ep')
125
- assert_equal(creds.token, 'raw_tok')
128
+ assert_equal('raw_ep', creds.endpoint)
129
+ assert_equal('raw_tok', creds.token)
126
130
  refute creds[:proxy]
127
131
 
128
132
  assert_instance_of(Map, proxy)
129
- assert_equal(config.proxy, 'raw_proxy')
133
+ assert_equal('raw_proxy', config.proxy)
130
134
  refute proxy[:endpoint]
131
135
  end
132
136
 
133
137
  def test_cred_files_no_opts
134
138
  x = wf.cred_files
135
139
  assert_instance_of(Array, x)
136
- assert_equal(x.length, 3)
140
+ assert_equal(3, x.length)
137
141
  x.each { |p| assert_instance_of(Pathname, p) }
138
142
  assert_includes(x, Pathname.new('/etc/wavefront/credentials'))
139
143
  assert_includes(x, Pathname.new(ENV['HOME']) + '.wavefront')
@@ -143,22 +147,22 @@ class GibletsTest < MiniTest::Test
143
147
  def test_cred_files_opts
144
148
  x = wf.cred_files(file: '/test/file')
145
149
  assert_instance_of(Array, x)
146
- assert_equal(x.length, 1)
147
- assert_equal(x, Array(Pathname.new('/test/file')))
150
+ assert_equal(1, x.length)
151
+ assert_equal(Array(Pathname.new('/test/file')), x)
148
152
  end
149
153
 
150
154
  def test_load_from_file
151
- assert_equal(wf.load_from_file(
155
+ assert_equal({},
156
+ wf.load_from_file(
152
157
  [Pathname.new('/no/file/1'), Pathname.new('/no/file/2')]
153
- ), {})
158
+ ))
154
159
 
155
- assert_equal(wf.load_from_file([CONF1], 'noprofile'),
156
- file: CONF1)
160
+ assert_equal({ file: CONF1 }, wf.load_from_file([CONF1], 'noprofile'))
157
161
 
158
162
  x = wf.load_from_file([CONF2, CONF1], 'default')
159
163
  assert_instance_of(Hash, x)
160
- assert_equal(x.keys.size, 5)
161
- assert_equal(x[:proxy], 'wavefront.localnet')
164
+ assert_equal(5, x.keys.size)
165
+ assert_equal('wavefront.localnet', x[:proxy])
162
166
 
163
167
  %i[token endpoint proxy sourceformat file].each do |k|
164
168
  assert_includes(x.keys, k)
@@ -167,15 +171,15 @@ class GibletsTest < MiniTest::Test
167
171
  y = wf.load_from_file([CONF2, CONF1], 'other')
168
172
  assert_instance_of(Hash, y)
169
173
  %i[token endpoint proxy file].each { |k| assert_includes(y.keys, k) }
170
- assert_equal(y.keys.size, 4)
171
- assert_equal(y[:proxy], 'otherwf.localnet')
174
+ assert_equal(4, y.keys.size)
175
+ assert_equal('otherwf.localnet', y[:proxy])
172
176
 
173
177
  z = wf.load_from_file([CONF1, CONF2], 'default')
174
178
  assert_instance_of(Hash, z)
175
179
  %i[token endpoint proxy file].each { |k| assert_includes(z.keys, k) }
176
- assert_equal(z.keys.size, 4)
177
- assert_equal(z[:proxy], 'wavefront.lab')
178
- assert_equal(z[:endpoint], 'somewhere.wavefront.com')
180
+ assert_equal(4, z.keys.size)
181
+ assert_equal('wavefront.lab', z[:proxy])
182
+ assert_equal('somewhere.wavefront.com', z[:endpoint])
179
183
  end
180
184
 
181
185
  def test_load_profile
@@ -22,11 +22,6 @@ DASHBOARD_BODY = {
22
22
  ]
23
23
  }.freeze
24
24
 
25
- U_ACL_1 = { name: 'someone@example.com', id: 'someone@example.com' }.freeze
26
- U_ACL_2 = { name: 'other@elsewhere.com', id: 'other@elsewhere.com' }.freeze
27
- GRP_ACL = { name: 'example group',
28
- id: 'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672' }.freeze
29
-
30
25
  # Unit tests for dashboard class
31
26
  #
32
27
  class WavefrontDashboardTest < WavefrontTestBase
@@ -80,6 +75,10 @@ class WavefrontDashboardTest < WavefrontTestBase
80
75
  tag_tester(DASHBOARD)
81
76
  end
82
77
 
78
+ def test_acls
79
+ acl_tester(DASHBOARD)
80
+ end
81
+
83
82
  def test_undelete
84
83
  should_work(:undelete, DASHBOARD, ["#{DASHBOARD}/undelete",
85
84
  nil], :post, POST_HEADERS)
@@ -93,51 +92,4 @@ class WavefrontDashboardTest < WavefrontTestBase
93
92
  nil], :post, POST_HEADERS)
94
93
  should_be_invalid(:unfavorite)
95
94
  end
96
-
97
- def test_acls
98
- should_work(:acls, [%w[dash1 dash2]], 'acl?id=dash1&id=dash2')
99
- end
100
-
101
- def test_acl_add
102
- should_work(:acl_add, [DASHBOARD, [U_ACL_1, U_ACL_2], [GRP_ACL]],
103
- 'acl/add', :post, {}, acl_body(DASHBOARD,
104
- [U_ACL_1, U_ACL_2],
105
- [GRP_ACL]))
106
-
107
- should_work(:acl_add, [DASHBOARD, [U_ACL_1, U_ACL_2]],
108
- 'acl/add', :post, {}, acl_body(DASHBOARD,
109
- [U_ACL_1, U_ACL_2]))
110
- assert_raises(ArgumentError) { wf.acl_add(DASHBOARD, U_ACL_1) }
111
- assert_raises(ArgumentError) do
112
- wf.acl_add(DASHBOARD, [U_ACL_1], GRP_ACL)
113
- end
114
- end
115
-
116
- def test_acl_remove
117
- should_work(:acl_delete, [DASHBOARD, [U_ACL_1, U_ACL_2], [GRP_ACL]],
118
- 'acl/remove', :post, {}, acl_body(DASHBOARD,
119
- [U_ACL_1, U_ACL_2],
120
- [GRP_ACL]))
121
-
122
- should_work(:acl_delete, [DASHBOARD, [U_ACL_1, U_ACL_2]],
123
- 'acl/remove', :post, {}, acl_body(DASHBOARD,
124
- [U_ACL_1, U_ACL_2]))
125
- assert_raises(ArgumentError) { wf.acl_delete(DASHBOARD, U_ACL_1) }
126
- end
127
-
128
- def test_acl_set
129
- should_work(:acl_set, [DASHBOARD, [U_ACL_1, U_ACL_2], [GRP_ACL]],
130
- 'acl/set', :put, {}, acl_body(DASHBOARD,
131
- [U_ACL_1, U_ACL_2],
132
- [GRP_ACL]))
133
-
134
- should_work(:acl_set, [DASHBOARD, [U_ACL_1, U_ACL_2]],
135
- 'acl/set', :put, {}, acl_body(DASHBOARD,
136
- [U_ACL_1, U_ACL_2]))
137
- assert_raises(ArgumentError) { wf.acl_set(DASHBOARD, U_ACL_1) }
138
- end
139
-
140
- def acl_body(id, view = [], modify = [])
141
- [{ entityId: id, viewAcl: view, modifyAcl: modify }].to_json
142
- end
143
95
  end