MuranoCLI 3.0.2 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +30 -59
  3. data/Gemfile +9 -3
  4. data/MuranoCLI.gemspec +11 -4
  5. data/bin/murano +2 -90
  6. data/lib/MrMurano.rb +5 -1
  7. data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
  8. data/lib/MrMurano/Solution.rb +12 -15
  9. data/lib/MrMurano/SolutionId.rb +1 -5
  10. data/lib/MrMurano/SyncAllowed.rb +2 -2
  11. data/lib/MrMurano/SyncUpDown.rb +6 -3
  12. data/lib/MrMurano/progress.rb +11 -2
  13. data/lib/MrMurano/verbosing.rb +3 -2
  14. data/lib/MrMurano/version.rb +2 -2
  15. data/spec/Account-Passwords_spec.rb +34 -48
  16. data/spec/Account_spec.rb +58 -63
  17. data/spec/Business_spec.rb +151 -139
  18. data/spec/ConfigFile_spec.rb +15 -11
  19. data/spec/ConfigMigrate_spec.rb +23 -12
  20. data/spec/Config_spec.rb +57 -54
  21. data/spec/Content_spec.rb +233 -201
  22. data/spec/GatewayBase_spec.rb +35 -27
  23. data/spec/GatewayDevice_spec.rb +149 -149
  24. data/spec/GatewayResource_spec.rb +115 -102
  25. data/spec/GatewaySettings_spec.rb +69 -62
  26. data/spec/Http_spec.rb +66 -56
  27. data/spec/MakePretties_spec.rb +82 -73
  28. data/spec/Mock_spec.rb +38 -29
  29. data/spec/ProjectFile_spec.rb +118 -106
  30. data/spec/Setting_spec.rb +24 -15
  31. data/spec/Solution-ServiceConfig_spec.rb +168 -140
  32. data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
  33. data/spec/Solution-ServiceModules_spec.rb +314 -232
  34. data/spec/Solution-UsersRoles_spec.rb +136 -86
  35. data/spec/Solution_spec.rb +78 -50
  36. data/spec/SyncRoot_spec.rb +26 -24
  37. data/spec/SyncUpDown_spec.rb +268 -249
  38. data/spec/Verbosing_spec.rb +95 -93
  39. data/spec/Webservice-Cors_spec.rb +141 -95
  40. data/spec/Webservice-Endpoint_spec.rb +382 -346
  41. data/spec/Webservice-File_spec.rb +148 -109
  42. data/spec/Webservice-Setting_spec.rb +47 -41
  43. data/spec/cmd_business_spec.rb +17 -17
  44. data/spec/cmd_common.rb +27 -7
  45. data/spec/cmd_config_spec.rb +31 -20
  46. data/spec/cmd_content_spec.rb +80 -68
  47. data/spec/cmd_cors_spec.rb +11 -5
  48. data/spec/cmd_device_spec.rb +16 -14
  49. data/spec/cmd_domain_spec.rb +10 -8
  50. data/spec/cmd_exchange_spec.rb +3 -3
  51. data/spec/cmd_init_spec.rb +100 -101
  52. data/spec/cmd_keystore_spec.rb +17 -12
  53. data/spec/cmd_link_spec.rb +22 -37
  54. data/spec/cmd_password_spec.rb +11 -7
  55. data/spec/cmd_setting_application_spec.rb +47 -33
  56. data/spec/cmd_setting_product_spec.rb +32 -27
  57. data/spec/cmd_status_spec.rb +125 -114
  58. data/spec/cmd_syncdown_spec.rb +70 -65
  59. data/spec/cmd_syncup_spec.rb +19 -15
  60. data/spec/cmd_usage_spec.rb +14 -10
  61. metadata +29 -15
@@ -1,3 +1,10 @@
1
+ # Last Modified: 2017.09.12 /coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright © 2016-2017 Exosite LLC.
5
+ # License: MIT. See LICENSE.txt.
6
+ # vim:tw=0:ts=2:sw=2:et:ai
7
+
1
8
  require 'tempfile'
2
9
  require 'MrMurano/hash'
3
10
  require 'MrMurano/version'
@@ -6,7 +13,7 @@ require 'MrMurano/SyncRoot'
6
13
  require '_workspace'
7
14
 
8
15
  RSpec.describe MrMurano::Role do
9
- include_context "WORKSPACE"
16
+ include_context 'WORKSPACE'
10
17
  before(:example) do
11
18
  MrMurano::SyncRoot.instance.reset
12
19
  $cfg = MrMurano::Config.new
@@ -15,92 +22,125 @@ RSpec.describe MrMurano::Role do
15
22
  $cfg['application.id'] = 'XYZ'
16
23
 
17
24
  @srv = MrMurano::Role.new
18
- allow(@srv).to receive(:token).and_return("TTTTTTTTTT")
25
+ allow(@srv).to receive(:token).and_return('TTTTTTTTTT')
19
26
  end
20
27
 
21
- it "initializes" do
28
+ it 'initializes' do
22
29
  uri = @srv.endpoint('/')
23
- expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/")
30
+ expect(uri.to_s).to eq(
31
+ 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
32
+ )
24
33
  end
25
34
 
26
- it "lists" do
27
- body = [{:role_id=>"guest", :parameter=>[{:name=>"did"}]},
28
- {:role_id=>"admin", :parameter=>[{:name=>"enabled"}]},
29
- {:role_id=>"owns", :parameter=>[{:name=>"did"}]}]
30
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role").
31
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
32
- 'Content-Type'=>'application/json'}).
33
- to_return(body: body.to_json)
35
+ it 'lists' do
36
+ body = [
37
+ {
38
+ role_id: 'guest', parameter: [{ name: 'did' }],
39
+ },
40
+ { role_id: 'admin', parameter: [{ name: 'enabled' }] },
41
+ { role_id: 'owns', parameter: [{ name: 'did' }] },
42
+ ]
43
+ stub_request(
44
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role'
45
+ ).with(
46
+ headers: {
47
+ 'Authorization' => 'token TTTTTTTTTT',
48
+ 'Content-Type' => 'application/json',
49
+ }
50
+ ).to_return(body: body.to_json)
34
51
  ret = @srv.list
35
52
  expect(ret).to eq(body)
36
53
  end
37
54
 
38
- it "fetches" do
39
- body = {:role_id=>"guest", :parameter=>[{:name=>"did"}]}
40
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest").
41
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
42
- 'Content-Type'=>'application/json'}).
43
- to_return(body: body.to_json)
55
+ it 'fetches' do
56
+ body = { role_id: 'guest', parameter: [{ name: 'did' }] }
57
+ stub_request(
58
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
59
+ ).with(
60
+ headers: {
61
+ 'Authorization' => 'token TTTTTTTTTT',
62
+ 'Content-Type' => 'application/json',
63
+ }
64
+ ).to_return(body: body.to_json)
44
65
  ret = @srv.fetch('guest')
45
66
  expect(ret).to eq(body)
46
67
  end
47
68
 
48
- it "removes" do
49
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest").
50
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
51
- 'Content-Type'=>'application/json'}).
52
- to_return(status: 200, body: "")
69
+ it 'removes' do
70
+ stub_request(
71
+ :delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
72
+ ).with(
73
+ headers: {
74
+ 'Authorization' => 'token TTTTTTTTTT',
75
+ 'Content-Type' => 'application/json',
76
+ }
77
+ ).to_return(status: 200, body: '')
53
78
  ret = @srv.remove('guest')
54
79
  expect(ret).to eq({})
55
80
  end
56
81
 
57
- context "uploads" do
58
- it "updating" do
59
- body = {:role_id=>"guest", :parameter=>[{:name=>"did"}]}
60
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest").
61
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
62
- 'Content-Type'=>'application/json'}).
63
- to_return(status: 200, body: "")
64
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/").
65
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
66
- 'Content-Type'=>'application/json'},
67
- :body=>body.to_json
68
- ).
69
- to_return(status: 205, body: "")
70
-
82
+ context 'uploads' do
83
+ it 'updating' do
84
+ body = { role_id: 'guest', parameter: [{ name: 'did' }] }
85
+ stub_request(
86
+ :delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
87
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
88
+ 'Content-Type' => 'application/json', }).to_return(status: 200, body: '')
89
+ stub_request(
90
+ :post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
91
+ ).with(
92
+ headers: {
93
+ 'Authorization' => 'token TTTTTTTTTT',
94
+ 'Content-Type' => 'application/json',
95
+ },
96
+ body: body.to_json
97
+ ).to_return(status: 205, body: '')
71
98
 
72
99
  @srv.upload(nil, body, true)
73
100
  end
74
101
 
75
- it "creating" do
76
- body = {:role_id=>"guest", :parameter=>[{:name=>"did"}]}
77
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest").
78
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
79
- 'Content-Type'=>'application/json'}).
80
- to_return(status: 404, body: "")
81
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/").
82
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
83
- 'Content-Type'=>'application/json'},
84
- :body=>body.to_json
85
- ).
86
- to_return(status: 205, body: "")
87
-
102
+ it 'creating' do
103
+ body = { role_id: 'guest', parameter: [{ name: 'did' }] }
104
+ stub_request(
105
+ :delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
106
+ ).with(
107
+ headers: {
108
+ 'Authorization' => 'token TTTTTTTTTT',
109
+ 'Content-Type' => 'application/json',
110
+ }
111
+ ).to_return(status: 404, body: '')
112
+ stub_request(
113
+ :post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
114
+ ).with(
115
+ headers: {
116
+ 'Authorization' => 'token TTTTTTTTTT',
117
+ 'Content-Type' => 'application/json',
118
+ },
119
+ body: body.to_json
120
+ ).to_return(status: 205, body: '')
88
121
 
89
122
  @srv.upload(nil, body, false)
90
123
  end
91
124
 
92
- it "with delete error" do
93
- body = {:role_id=>"guest", :parameter=>[{:name=>"did"}]}
94
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest").
95
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
96
- 'Content-Type'=>'application/json'}).
97
- to_return(status: 418, body: "I'm a teapot!")
98
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/").
99
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
100
- 'Content-Type'=>'application/json'},
101
- :body=>body.to_json
102
- ).
103
- to_return(status: 205, body: "")
125
+ it 'with delete error' do
126
+ body = { role_id: 'guest', parameter: [{ name: 'did' }] }
127
+ stub_request(
128
+ :delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
129
+ ).with(
130
+ headers: {
131
+ 'Authorization' => 'token TTTTTTTTTT',
132
+ 'Content-Type' => 'application/json',
133
+ }
134
+ ).to_return(status: 418, body: "I'm a teapot!")
135
+ stub_request(
136
+ :post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
137
+ ).with(
138
+ headers: {
139
+ 'Authorization' => 'token TTTTTTTTTT',
140
+ 'Content-Type' => 'application/json',
141
+ },
142
+ body: body.to_json
143
+ ).to_return(status: 205, body: '')
104
144
 
105
145
  saved = $stderr
106
146
  $stderr = StringIO.new
@@ -110,13 +150,13 @@ RSpec.describe MrMurano::Role do
110
150
  end
111
151
  end
112
152
 
113
- context "downloads" do
153
+ context 'downloads' do
114
154
  before(:example) do
115
155
  @lry = Pathname.new(@project_dir) + 'roles.yaml'
116
- @grl = {:role_id=>"guest", :parameter=>[{:name=>"could"}]}
156
+ @grl = { role_id: 'guest', parameter: [{ name: 'could' }] }
117
157
  end
118
158
 
119
- it "creates" do
159
+ it 'creates' do
120
160
  @srv.download(@lry, @grl)
121
161
 
122
162
  expect(@lry.exist?).to be true
@@ -124,7 +164,7 @@ RSpec.describe MrMurano::Role do
124
164
  expect(got).to include(Hash.transform_keys_to_strings(@grl))
125
165
  end
126
166
 
127
- it "updates" do
167
+ it 'updates' do
128
168
  FileUtils.copy(File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path)
129
169
 
130
170
  @srv.download(@lry, @grl)
@@ -133,30 +173,34 @@ RSpec.describe MrMurano::Role do
133
173
  end
134
174
  end
135
175
 
136
- context "removing local roles" do
176
+ context 'removing local roles' do
137
177
  before(:example) do
138
178
  @lry = Pathname.new(@project_dir) + 'roles.yaml'
139
- @grl = {:role_id=>"guest", :parameter=>[{:name=>"could"}]}
179
+ @grl = { role_id: 'guest', parameter: [{ name: 'could' }] }
140
180
  end
141
181
 
142
- it "when file missing" do
182
+ it 'when file missing' do
143
183
  @srv.removelocal(@lry, @grl)
144
184
  expect(@lry.exist?).to be true
145
185
  got = YAML.load(@lry.read)
146
186
  expect(got).to eq([])
147
187
  end
148
188
 
149
- it "when not there" do
150
- FileUtils.copy(File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path)
151
- @srv.removelocal(@lry, {:role_id=>"undertow"})
189
+ it 'when not there' do
190
+ FileUtils.copy(
191
+ File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path
192
+ )
193
+ @srv.removelocal(@lry, role_id: 'undertow')
152
194
  got = YAML.load(@lry.read)
153
195
  rty = Pathname.new(@testdir) + 'spec/fixtures/roles-three.yaml'
154
196
  want = YAML.load(rty.read)
155
197
  expect(got).to eq(want)
156
198
  end
157
199
 
158
- it "with matching role" do
159
- FileUtils.copy(File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path)
200
+ it 'with matching role' do
201
+ FileUtils.copy(
202
+ File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path
203
+ )
160
204
  @srv.removelocal(@lry, @grl)
161
205
  got = YAML.load(@lry.read)
162
206
  expect(got.count).to eq(2)
@@ -167,43 +211,49 @@ RSpec.describe MrMurano::Role do
167
211
  end
168
212
  end
169
213
 
170
- it "tolocalpath is into" do
214
+ it 'tolocalpath is into' do
171
215
  lry = Pathname.new(@project_dir) + 'roles.yaml'
172
- ret = @srv.tolocalpath(lry, {:role_id=>"guest", :parameter=>[{:name=>"could"}]})
216
+ ret = @srv.tolocalpath(lry, role_id: 'guest', parameter: [{ name: 'could' }])
173
217
  expect(ret).to eq(lry)
174
218
  end
175
219
 
176
- context "list local items" do
220
+ context 'list local items' do
177
221
  before(:example) do
178
222
  @lry = Pathname.new(@project_dir) + 'roles.yaml'
179
223
  end
180
224
 
181
- it "when missing" do
225
+ it 'when missing' do
182
226
  expect(@srv).to receive(:warning).with(/^Skipping missing/)
183
227
  ret = @srv.localitems(@lry)
184
228
  expect(ret).to eq([])
185
229
  end
186
230
 
187
- it "when not a file" do
231
+ it 'when not a file' do
188
232
  FileUtils.mkpath(@lry.to_path)
189
233
  expect(@srv).to receive(:warning).with(/^Cannot read from/)
190
234
  ret = @srv.localitems(@lry)
191
235
  expect(ret).to eq([])
192
236
  end
193
237
 
194
- it "when empty" do
238
+ it 'when empty' do
195
239
  FileUtils.touch(@lry.to_path)
196
240
  ret = @srv.localitems(@lry)
197
241
  expect(ret).to eq([])
198
242
  end
199
243
 
200
- it "with roles" do
201
- FileUtils.copy(File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path)
244
+ it 'with roles' do
245
+ FileUtils.copy(
246
+ File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path
247
+ )
202
248
  ret = @srv.localitems(@lry)
203
- expect(ret).to eq([{:role_id=>"guest", :parameter=>[{:name=>"did"}]},
204
- {:role_id=>"admin", :parameter=>[{:name=>"enabled"}]},
205
- {:role_id=>"owns", :parameter=>[{:name=>"did"}]}])
249
+ expect(ret).to eq(
250
+ [
251
+ { role_id: 'guest', parameter: [{ name: 'did' }] },
252
+ { role_id: 'admin', parameter: [{ name: 'enabled' }] },
253
+ { role_id: 'owns', parameter: [{ name: 'did' }] },
254
+ ]
255
+ )
206
256
  end
207
257
  end
208
258
  end
209
- # vim: set ai et sw=2 ts=2 :
259
+
@@ -1,3 +1,10 @@
1
+ # Last Modified: 2017.09.12 /coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright © 2016-2017 Exosite LLC.
5
+ # License: MIT. See LICENSE.txt.
6
+ # vim:tw=0:ts=2:sw=2:et:ai
7
+
1
8
  require 'tempfile'
2
9
  require 'yaml'
3
10
  require 'MrMurano/version'
@@ -7,7 +14,7 @@ require 'MrMurano/SyncRoot'
7
14
  require '_workspace'
8
15
 
9
16
  RSpec.describe MrMurano::Solution do
10
- include_context "WORKSPACE"
17
+ include_context 'WORKSPACE'
11
18
  before(:example) do
12
19
  MrMurano::SyncRoot.instance.reset
13
20
  $cfg = MrMurano::Config.new
@@ -23,79 +30,100 @@ RSpec.describe MrMurano::Solution do
23
30
  @srv = MrMurano::Product.new
24
31
  #@srv = MrMurano::Application.new
25
32
 
26
- allow(@srv).to receive(:token).and_return("TTTTTTTTTT")
33
+ allow(@srv).to receive(:token).and_return('TTTTTTTTTT')
27
34
  end
28
35
 
29
- it "initializes" do
36
+ it 'initializes' do
30
37
  uri = @srv.endpoint('/')
31
- expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/solution/XYZ/")
38
+ expect(uri.to_s).to eq(
39
+ 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/'
40
+ )
32
41
  end
33
42
 
34
- it "gets info" do
43
+ it 'gets info' do
35
44
  body = {
36
- :id=>"XYZ",
37
- :label=>nil,
38
- :domain=>"ugdemo.apps.exosite.io",
39
- :biz_id=>"ABCDEFG",
40
- :cors=> "{\"origin\":true,\"methods\":[\"HEAD\",\"GET\",\"POST\",\"PUT\",\"DELETE\",\"OPTIONS\",\"PATCH\"],\"headers\":[\"Content-Type\",\"Cookie\",\"Authorization\"],\"credentials\":true}"
45
+ id: 'XYZ',
46
+ label: nil,
47
+ domain: 'ugdemo.apps.exosite.io',
48
+ biz_id: 'ABCDEFG',
49
+ cors: '{"origin":true,"methods":["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],"headers":["Content-Type","Cookie","Authorization"],"credentials":true}',
41
50
  }
42
51
 
43
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ").
44
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
45
- 'Content-Type'=>'application/json'}).
46
- to_return(body: body.to_json)
52
+ stub_request(
53
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ'
54
+ ).with(
55
+ headers: {
56
+ 'Authorization' => 'token TTTTTTTTTT',
57
+ 'Content-Type' => 'application/json',
58
+ }
59
+ ).to_return(body: body.to_json)
47
60
 
48
- ret = @srv.info()
61
+ ret = @srv.info
49
62
  expect(ret).to eq(body)
50
63
  end
51
64
 
52
- it "lists" do
65
+ it 'lists' do
53
66
  body = {
54
- :id=>"XYZ",
55
- :label=>nil,
56
- :domain=>"ugdemo.apps.exosite.io",
57
- :biz_id=>"ABCDEFG",
58
- :cors=> "{\"origin\":true,\"methods\":[\"HEAD\",\"GET\",\"POST\",\"PUT\",\"DELETE\",\"OPTIONS\",\"PATCH\"],\"headers\":[\"Content-Type\",\"Cookie\",\"Authorization\"],\"credentials\":true}"
67
+ id: 'XYZ',
68
+ label: nil,
69
+ domain: 'ugdemo.apps.exosite.io',
70
+ biz_id: 'ABCDEFG',
71
+ cors: '{"origin":true,"methods":["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],"headers":["Content-Type","Cookie","Authorization"],"credentials":true}',
59
72
  }
60
73
 
61
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/").
62
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
63
- 'Content-Type'=>'application/json'}).
64
- to_return(body: body.to_json)
74
+ stub_request(
75
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/'
76
+ ).with(
77
+ headers: {
78
+ 'Authorization' => 'token TTTTTTTTTT',
79
+ 'Content-Type' => 'application/json',
80
+ }
81
+ ).to_return(body: body.to_json)
65
82
 
66
83
  ret = @srv.list
67
84
  expect(ret).to eq(body)
68
85
  end
69
86
 
70
- it "Gets version" do
71
- body = {:min_cli_version=>"0.10"}
72
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/version").
73
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
74
- 'Content-Type'=>'application/json'}).
75
- to_return(body: body.to_json)
76
-
77
- ret = @srv.version()
87
+ it 'Gets version' do
88
+ body = { min_cli_version: '0.10' }
89
+ stub_request(
90
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/version'
91
+ ).with(
92
+ headers: {
93
+ 'Authorization' => 'token TTTTTTTTTT',
94
+ 'Content-Type' => 'application/json',
95
+ }
96
+ ).to_return(body: body.to_json)
97
+
98
+ ret = @srv.version
78
99
  expect(ret).to eq(body)
79
100
  end
80
101
 
81
- it "Gets logs" do
82
- body = {:p=>[
83
- {:type=>"error",
84
- :timestamp=>1481746755,
85
- :subject=>"service call failed",
86
- :data=>{:service_alias=>"user", :function_call=>"assignUser"}
87
- }, ],
88
- :total=>1}
89
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/logs").
90
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
91
- 'Content-Type'=>'application/json'}).
92
- to_return(body: body.to_json)
93
-
94
- ret = @srv.log()
102
+ it 'Gets logs' do
103
+ body = {
104
+ p: [
105
+ {
106
+ type: 'error',
107
+ timestamp: 1_481_746_755,
108
+ subject: 'service call failed',
109
+ data: {
110
+ service_alias: 'user', function_call: 'assignUser',
111
+ },
112
+ },
113
+ ],
114
+ total: 1,
115
+ }
116
+ stub_request(
117
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/logs'
118
+ ).with(
119
+ headers: {
120
+ 'Authorization' => 'token TTTTTTTTTT',
121
+ 'Content-Type' => 'application/json',
122
+ }
123
+ ).to_return(body: body.to_json)
124
+
125
+ ret = @srv.log
95
126
  expect(ret).to eq(body)
96
127
  end
97
-
98
128
  end
99
129
 
100
- # vim: set ai et sw=2 ts=2 :
101
-