MuranoCLI 3.0.2 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +30 -59
- data/Gemfile +9 -3
- data/MuranoCLI.gemspec +11 -4
- data/bin/murano +2 -90
- data/lib/MrMurano.rb +5 -1
- data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
- data/lib/MrMurano/Solution.rb +12 -15
- data/lib/MrMurano/SolutionId.rb +1 -5
- data/lib/MrMurano/SyncAllowed.rb +2 -2
- data/lib/MrMurano/SyncUpDown.rb +6 -3
- data/lib/MrMurano/progress.rb +11 -2
- data/lib/MrMurano/verbosing.rb +3 -2
- data/lib/MrMurano/version.rb +2 -2
- data/spec/Account-Passwords_spec.rb +34 -48
- data/spec/Account_spec.rb +58 -63
- data/spec/Business_spec.rb +151 -139
- data/spec/ConfigFile_spec.rb +15 -11
- data/spec/ConfigMigrate_spec.rb +23 -12
- data/spec/Config_spec.rb +57 -54
- data/spec/Content_spec.rb +233 -201
- data/spec/GatewayBase_spec.rb +35 -27
- data/spec/GatewayDevice_spec.rb +149 -149
- data/spec/GatewayResource_spec.rb +115 -102
- data/spec/GatewaySettings_spec.rb +69 -62
- data/spec/Http_spec.rb +66 -56
- data/spec/MakePretties_spec.rb +82 -73
- data/spec/Mock_spec.rb +38 -29
- data/spec/ProjectFile_spec.rb +118 -106
- data/spec/Setting_spec.rb +24 -15
- data/spec/Solution-ServiceConfig_spec.rb +168 -140
- data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
- data/spec/Solution-ServiceModules_spec.rb +314 -232
- data/spec/Solution-UsersRoles_spec.rb +136 -86
- data/spec/Solution_spec.rb +78 -50
- data/spec/SyncRoot_spec.rb +26 -24
- data/spec/SyncUpDown_spec.rb +268 -249
- data/spec/Verbosing_spec.rb +95 -93
- data/spec/Webservice-Cors_spec.rb +141 -95
- data/spec/Webservice-Endpoint_spec.rb +382 -346
- data/spec/Webservice-File_spec.rb +148 -109
- data/spec/Webservice-Setting_spec.rb +47 -41
- data/spec/cmd_business_spec.rb +17 -17
- data/spec/cmd_common.rb +27 -7
- data/spec/cmd_config_spec.rb +31 -20
- data/spec/cmd_content_spec.rb +80 -68
- data/spec/cmd_cors_spec.rb +11 -5
- data/spec/cmd_device_spec.rb +16 -14
- data/spec/cmd_domain_spec.rb +10 -8
- data/spec/cmd_exchange_spec.rb +3 -3
- data/spec/cmd_init_spec.rb +100 -101
- data/spec/cmd_keystore_spec.rb +17 -12
- data/spec/cmd_link_spec.rb +22 -37
- data/spec/cmd_password_spec.rb +11 -7
- data/spec/cmd_setting_application_spec.rb +47 -33
- data/spec/cmd_setting_product_spec.rb +32 -27
- data/spec/cmd_status_spec.rb +125 -114
- data/spec/cmd_syncdown_spec.rb +70 -65
- data/spec/cmd_syncup_spec.rb +19 -15
- data/spec/cmd_usage_spec.rb +14 -10
- metadata +29 -15
data/spec/Setting_spec.rb
CHANGED
@@ -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,11 +14,14 @@ require 'MrMurano/SyncRoot'
|
|
7
14
|
require 'MrMurano/SyncUpDown'
|
8
15
|
require '_workspace'
|
9
16
|
|
17
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
18
|
+
# "Use nested module/class definitions instead of compact style."
|
10
19
|
module ::MrMurano
|
11
20
|
module Testset
|
12
21
|
class Settings
|
13
22
|
def specific
|
14
23
|
end
|
24
|
+
|
15
25
|
def specific=(x)
|
16
26
|
end
|
17
27
|
end
|
@@ -21,7 +31,7 @@ module ::MrMurano
|
|
21
31
|
end
|
22
32
|
|
23
33
|
RSpec.describe MrMurano::Setting do
|
24
|
-
include_context
|
34
|
+
include_context 'WORKSPACE'
|
25
35
|
before(:example) do
|
26
36
|
MrMurano::SyncRoot.instance.reset
|
27
37
|
$cfg = MrMurano::Config.new
|
@@ -32,37 +42,37 @@ RSpec.describe MrMurano::Setting do
|
|
32
42
|
@srv = MrMurano::Setting.new
|
33
43
|
end
|
34
44
|
|
35
|
-
context
|
36
|
-
it
|
45
|
+
context 'maps service name' do
|
46
|
+
it 'device2 into Gateway' do
|
37
47
|
ret = @srv.mapservice('device2')
|
38
48
|
expect(ret).to eq('Gateway')
|
39
49
|
end
|
40
50
|
|
41
|
-
it
|
51
|
+
it 'gaTeWaY into Gateway' do
|
42
52
|
ret = @srv.mapservice('gaTeWaY')
|
43
53
|
expect(ret).to eq('Gateway')
|
44
54
|
end
|
45
55
|
|
46
|
-
it
|
56
|
+
it 'WeBServICe into Webservice' do
|
47
57
|
ret = @srv.mapservice('WeBServICe')
|
48
58
|
expect(ret).to eq('Webservice')
|
49
59
|
end
|
50
60
|
|
51
|
-
it
|
61
|
+
it 'bob into Bob' do
|
52
62
|
ret = @srv.mapservice('bob')
|
53
63
|
expect(ret).to eq('Bob')
|
54
64
|
end
|
55
65
|
end
|
56
66
|
|
57
|
-
context
|
67
|
+
context 'read' do
|
58
68
|
it "displays error when Service doesn't exist" do
|
59
|
-
expect(@srv).to receive(:error).with(
|
69
|
+
expect(@srv).to receive(:error).with('No Settings on "Fiddlingsticks"')
|
60
70
|
ret = @srv.read('Fiddlingsticks', 'specific')
|
61
71
|
expect(ret).to be_nil
|
62
72
|
end
|
63
73
|
|
64
74
|
it "displays error when Service doesn't have any Settings" do
|
65
|
-
expect(@srv).to receive(:error).with(
|
75
|
+
expect(@srv).to receive(:error).with('No Settings on "Testsettwo"')
|
66
76
|
ret = @srv.read('Testsettwo', 'specific')
|
67
77
|
expect(ret).to be_nil
|
68
78
|
end
|
@@ -73,22 +83,22 @@ RSpec.describe MrMurano::Setting do
|
|
73
83
|
expect(ret).to be_nil
|
74
84
|
end
|
75
85
|
|
76
|
-
it
|
86
|
+
it 'the settings' do
|
77
87
|
expect_any_instance_of(MrMurano::Testset::Settings).to receive(:specific).and_return(4)
|
78
88
|
ret = @srv.read('Testset', 'specific')
|
79
89
|
expect(ret).to eq(4)
|
80
90
|
end
|
81
91
|
end
|
82
92
|
|
83
|
-
context
|
93
|
+
context 'writes' do
|
84
94
|
it "displays error when Service doesn't exist" do
|
85
|
-
expect(@srv).to receive(:error).with(
|
95
|
+
expect(@srv).to receive(:error).with('No Settings on "Fiddlingsticks"')
|
86
96
|
ret = @srv.write('Fiddlingsticks', 'specific', 4)
|
87
97
|
expect(ret).to be_nil
|
88
98
|
end
|
89
99
|
|
90
100
|
it "displays error when Service doesn't have any Settings" do
|
91
|
-
expect(@srv).to receive(:error).with(
|
101
|
+
expect(@srv).to receive(:error).with('No Settings on "Testsettwo"')
|
92
102
|
ret = @srv.write('Testsettwo', 'specific', 4)
|
93
103
|
expect(ret).to be_nil
|
94
104
|
end
|
@@ -99,7 +109,7 @@ RSpec.describe MrMurano::Setting do
|
|
99
109
|
expect(ret).to be_nil
|
100
110
|
end
|
101
111
|
|
102
|
-
it
|
112
|
+
it 'the settings' do
|
103
113
|
expect_any_instance_of(MrMurano::Testset::Settings).to receive(:specific=).with(4).and_return(4)
|
104
114
|
ret = @srv.write('Testset', 'specific', 4)
|
105
115
|
expect(ret).to eq(4)
|
@@ -107,4 +117,3 @@ RSpec.describe MrMurano::Setting do
|
|
107
117
|
end
|
108
118
|
end
|
109
119
|
|
110
|
-
# vim: set ai et sw=2 ts=2 :
|
@@ -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/version'
|
3
10
|
require 'MrMurano/ProjectFile'
|
@@ -6,7 +13,7 @@ require 'MrMurano/SyncRoot'
|
|
6
13
|
require '_workspace'
|
7
14
|
|
8
15
|
RSpec.describe MrMurano::ServiceConfig do
|
9
|
-
include_context
|
16
|
+
include_context 'WORKSPACE'
|
10
17
|
before(:example) do
|
11
18
|
MrMurano::SyncRoot.instance.reset
|
12
19
|
$cfg = MrMurano::Config.new
|
@@ -21,221 +28,242 @@ RSpec.describe MrMurano::ServiceConfig do
|
|
21
28
|
# ServiceConfig needs an api_id, else one could instantiate
|
22
29
|
# ServiceConfigApplication or ServiceConfigProduct.
|
23
30
|
@srv = MrMurano::ServiceConfig.new('XYZ')
|
24
|
-
allow(@srv).to receive(:token).and_return(
|
31
|
+
allow(@srv).to receive(:token).and_return('TTTTTTTTTT')
|
25
32
|
end
|
26
33
|
|
27
|
-
it
|
34
|
+
it 'initializes' do
|
28
35
|
uri = @srv.endpoint('/')
|
29
|
-
expect(uri.to_s).to eq(
|
36
|
+
expect(uri.to_s).to eq('https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/')
|
30
37
|
end
|
31
38
|
|
32
|
-
it
|
33
|
-
body = {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
it 'lists' do
|
40
|
+
body = {
|
41
|
+
items: [
|
42
|
+
{
|
43
|
+
id: '9K0',
|
44
|
+
name: 'debug',
|
45
|
+
alias: 'XYZ_debug',
|
46
|
+
solution_id: 'XYZ',
|
47
|
+
service: 'device',
|
48
|
+
status: 'ready',
|
49
|
+
created_at: '2016-07-07T19:16:19.479Z',
|
50
|
+
updated_at: '2016-09-12T13:26:55.868Z',
|
51
|
+
deleted_at: nil,
|
52
|
+
},
|
53
|
+
],
|
54
|
+
total: 1,
|
55
|
+
}
|
56
|
+
stub_request(
|
57
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig'
|
58
|
+
).with(
|
59
|
+
headers: { 'Authorization' => 'token TTTTTTTTTT',
|
60
|
+
'Content-Type' => 'application/json', }
|
61
|
+
).to_return(body: body.to_json)
|
47
62
|
|
48
63
|
ret = @srv.list
|
49
64
|
expect(ret).to eq(body[:items])
|
50
65
|
end
|
51
66
|
|
52
|
-
it
|
53
|
-
body = {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
67
|
+
it 'fetches' do
|
68
|
+
body = {
|
69
|
+
id: '9K0',
|
70
|
+
name: 'debug',
|
71
|
+
alias: 'XYZ_debug',
|
72
|
+
solution_id: 'XYZ',
|
73
|
+
service: 'device',
|
74
|
+
status: 'ready',
|
75
|
+
created_at: '2016-07-07T19:16:19.479Z',
|
76
|
+
updated_at: '2016-09-12T13:26:55.868Z',
|
61
77
|
}
|
62
|
-
stub_request(
|
63
|
-
|
64
|
-
|
65
|
-
|
78
|
+
stub_request(
|
79
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0'
|
80
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
81
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
66
82
|
|
67
83
|
ret = @srv.fetch('9K0')
|
68
84
|
expect(ret).to eq(body)
|
69
85
|
end
|
70
86
|
|
71
|
-
it
|
72
|
-
body = {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
87
|
+
it 'creates' do
|
88
|
+
body = {
|
89
|
+
id: '9K0',
|
90
|
+
name: 'debug',
|
91
|
+
alias: 'XYZ_debug',
|
92
|
+
solution_id: 'XYZ',
|
93
|
+
service: 'device',
|
94
|
+
status: 'ready',
|
95
|
+
created_at: '2016-07-07T19:16:19.479Z',
|
96
|
+
updated_at: '2016-09-12T13:26:55.868Z',
|
80
97
|
}
|
81
98
|
# VERIFY/2017-07-03: Does this POST now need a trailing path delimiter?
|
82
99
|
#stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig").
|
83
|
-
stub_request(
|
84
|
-
|
85
|
-
|
86
|
-
|
100
|
+
stub_request(
|
101
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/'
|
102
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
103
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
87
104
|
|
88
105
|
ret = @srv.create('p4q0m2ruyoxierh')
|
89
106
|
expect(ret).to eq(body)
|
90
107
|
end
|
91
108
|
|
92
|
-
it
|
109
|
+
it 'removes' do
|
93
110
|
body = {}
|
94
|
-
stub_request(
|
95
|
-
|
96
|
-
|
97
|
-
|
111
|
+
stub_request(
|
112
|
+
:delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0'
|
113
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
114
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
98
115
|
|
99
116
|
ret = @srv.remove('9K0')
|
100
117
|
expect(ret).to eq(body)
|
101
118
|
end
|
102
119
|
|
103
|
-
it
|
104
|
-
body = {
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
120
|
+
it 'gets id from service' do
|
121
|
+
body = {
|
122
|
+
items: [
|
123
|
+
{
|
124
|
+
id: '9K0',
|
125
|
+
name: 'debug',
|
126
|
+
alias: 'XYZ_debug',
|
127
|
+
solution_id: 'XYZ',
|
128
|
+
service: 'device',
|
129
|
+
status: 'ready',
|
130
|
+
created_at: '2016-07-07T19:16:19.479Z',
|
131
|
+
updated_at: '2016-09-12T13:26:55.868Z',
|
132
|
+
deleted_at: nil,
|
133
|
+
},
|
134
|
+
],
|
135
|
+
total: 1,
|
136
|
+
}
|
137
|
+
stub_request(
|
138
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig'
|
139
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
140
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
118
141
|
|
119
142
|
ret = @srv.scid_for_name('device')
|
120
|
-
expect(ret).to eq(
|
143
|
+
expect(ret).to eq('9K0')
|
121
144
|
end
|
122
145
|
|
123
|
-
it
|
124
|
-
body = {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
146
|
+
it 'gets nil if not there' do
|
147
|
+
body = {
|
148
|
+
items: [
|
149
|
+
{
|
150
|
+
id: '9K0',
|
151
|
+
name: 'debug',
|
152
|
+
alias: 'XYZ_debug',
|
153
|
+
solution_id: 'XYZ',
|
154
|
+
service: 'device',
|
155
|
+
status: 'ready',
|
156
|
+
created_at: '2016-07-07T19:16:19.479Z',
|
157
|
+
updated_at: '2016-09-12T13:26:55.868Z',
|
158
|
+
deleted_at: nil,
|
159
|
+
},
|
160
|
+
],
|
161
|
+
total: 1,
|
162
|
+
}
|
163
|
+
stub_request(
|
164
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig'
|
165
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
166
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
138
167
|
|
139
168
|
ret = @srv.scid_for_name('debug')
|
140
169
|
expect(ret).to eq(nil)
|
141
170
|
end
|
142
171
|
|
143
|
-
it
|
144
|
-
body = {:
|
145
|
-
stub_request(
|
146
|
-
|
147
|
-
|
148
|
-
|
172
|
+
it 'gets info' do
|
173
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
174
|
+
stub_request(
|
175
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/info'
|
176
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
177
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
149
178
|
|
150
179
|
ret = @srv.info('9K0')
|
151
180
|
expect(ret).to eq(body)
|
152
181
|
end
|
153
182
|
|
154
|
-
context
|
183
|
+
context 'calls' do
|
155
184
|
before(:example) do
|
156
|
-
allow(@srv).to receive(:scid).and_return(
|
185
|
+
allow(@srv).to receive(:scid).and_return('9K0')
|
157
186
|
end
|
158
|
-
it
|
159
|
-
body = {:
|
160
|
-
stub_request(
|
161
|
-
|
162
|
-
|
163
|
-
to_return(body: body.to_json)
|
187
|
+
it 'a get' do
|
188
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
189
|
+
stub_request(
|
190
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/info'
|
191
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
192
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
164
193
|
|
165
194
|
ret = @srv.call(:info)
|
166
195
|
expect(ret).to eq(body)
|
167
196
|
end
|
168
197
|
|
169
|
-
it
|
170
|
-
body = {:
|
171
|
-
stub_request(
|
172
|
-
|
173
|
-
|
174
|
-
to_return(body: body.to_json)
|
198
|
+
it 'a get with query' do
|
199
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
200
|
+
stub_request(
|
201
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask?q=what'
|
202
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
203
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
175
204
|
|
176
|
-
ret = @srv.call(:ask, :get,
|
205
|
+
ret = @srv.call(:ask, :get, q: 'what')
|
177
206
|
expect(ret).to eq(body)
|
178
207
|
end
|
179
208
|
|
180
|
-
it
|
181
|
-
body = {:
|
182
|
-
stub_request(
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
to_return(body: body.to_json)
|
209
|
+
it 'a post' do
|
210
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
211
|
+
stub_request(
|
212
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
|
213
|
+
).with(body: JSON.generate(q: 'what'),
|
214
|
+
headers: { 'Authorization' => 'token TTTTTTTTTT',
|
215
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
187
216
|
|
188
|
-
ret = @srv.call(:ask, :post,
|
217
|
+
ret = @srv.call(:ask, :post, q: 'what')
|
189
218
|
expect(ret).to eq(body)
|
190
219
|
end
|
191
220
|
|
192
|
-
it
|
193
|
-
body = {:
|
194
|
-
stub_request(
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
to_return(body: body.to_json)
|
221
|
+
it 'a post without data' do
|
222
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
223
|
+
stub_request(
|
224
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
|
225
|
+
).with(body: JSON.generate({}),
|
226
|
+
headers: { 'Authorization' => 'token TTTTTTTTTT',
|
227
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
199
228
|
|
200
229
|
ret = @srv.call(:ask, :post)
|
201
230
|
expect(ret).to eq(body)
|
202
231
|
end
|
203
232
|
|
204
|
-
it
|
205
|
-
body = {:
|
206
|
-
stub_request(
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
to_return(body: body.to_json)
|
233
|
+
it 'a put' do
|
234
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
235
|
+
stub_request(
|
236
|
+
:put, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
|
237
|
+
).with(body: JSON.generate(q: 'what'),
|
238
|
+
headers: { 'Authorization' => 'token TTTTTTTTTT',
|
239
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
211
240
|
|
212
|
-
ret = @srv.call(:ask, :put,
|
241
|
+
ret = @srv.call(:ask, :put, q: 'what')
|
213
242
|
expect(ret).to eq(body)
|
214
243
|
end
|
215
244
|
|
216
|
-
it
|
217
|
-
body = {:
|
218
|
-
stub_request(
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
to_return(body: body.to_json)
|
245
|
+
it 'a put without data' do
|
246
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
247
|
+
stub_request(
|
248
|
+
:put, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
|
249
|
+
).with(body: JSON.generate({}),
|
250
|
+
headers: { 'Authorization' => 'token TTTTTTTTTT',
|
251
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
223
252
|
|
224
253
|
ret = @srv.call(:ask, :put)
|
225
254
|
expect(ret).to eq(body)
|
226
255
|
end
|
227
256
|
|
228
|
-
it
|
229
|
-
body = {:
|
230
|
-
stub_request(
|
231
|
-
|
232
|
-
|
233
|
-
to_return(body: body.to_json)
|
257
|
+
it 'a delete' do
|
258
|
+
body = { calls: { daily: 0, monthly: 0, total: 0 } }
|
259
|
+
stub_request(
|
260
|
+
:delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/gone'
|
261
|
+
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
262
|
+
'Content-Type' => 'application/json', }).to_return(body: body.to_json)
|
234
263
|
|
235
264
|
ret = @srv.call(:gone, :delete)
|
236
265
|
expect(ret).to eq(body)
|
237
266
|
end
|
238
267
|
end
|
239
|
-
|
240
268
|
end
|
241
|
-
|
269
|
+
|