MuranoCLI 3.0.2 → 3.0.4
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/.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/ConfigMigrate_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 'erb'
|
2
9
|
require 'highline/import'
|
3
10
|
#require 'tempfile'
|
@@ -7,7 +14,7 @@ require 'MrMurano/ProjectFile'
|
|
7
14
|
require '_workspace'
|
8
15
|
|
9
16
|
RSpec.describe MrMurano::ConfigMigrate do
|
10
|
-
include_context
|
17
|
+
include_context 'WORKSPACE'
|
11
18
|
before(:example) do
|
12
19
|
@saved_pwd = ENV['MURANO_PASSWORD']
|
13
20
|
ENV['MURANO_PASSWORD'] = nil
|
@@ -22,12 +29,15 @@ RSpec.describe MrMurano::ConfigMigrate do
|
|
22
29
|
$project.load
|
23
30
|
|
24
31
|
@lry = Pathname.new(@project_dir) + '.Solutionfile.secret'
|
25
|
-
FileUtils.copy(
|
32
|
+
FileUtils.copy(
|
33
|
+
File.join(@testdir, 'spec/fixtures/SolutionFiles/secret.json'), @lry.to_path
|
34
|
+
)
|
26
35
|
|
27
36
|
@mrt = MrMurano::ConfigMigrate.new
|
28
37
|
|
29
38
|
@stdsaved = [$stdout, $stderr]
|
30
|
-
$stdout
|
39
|
+
$stdout = StringIO.new
|
40
|
+
$stderr = StringIO.new
|
31
41
|
end
|
32
42
|
|
33
43
|
after(:example) do
|
@@ -36,7 +46,7 @@ RSpec.describe MrMurano::ConfigMigrate do
|
|
36
46
|
ENV['MURANO_CONFIGFILE'] = @saved_cfg
|
37
47
|
end
|
38
48
|
|
39
|
-
it
|
49
|
+
it 'imports all' do
|
40
50
|
@mrt.import_secret
|
41
51
|
|
42
52
|
expect($cfg['application.id']).to eq('ABCDEFG')
|
@@ -45,12 +55,12 @@ RSpec.describe MrMurano::ConfigMigrate do
|
|
45
55
|
pff = $cfg.file_at('passwords', :user)
|
46
56
|
pwd = MrMurano::Passwords.new(pff)
|
47
57
|
pwd.load
|
48
|
-
expect(pwd.get$cfg['net.host'], $cfg['user.name']).to eq('gibblygook')
|
58
|
+
expect(pwd.get($cfg['net.host'], $cfg['user.name'])).to eq('gibblygook')
|
49
59
|
expect($stdout.string).to eq('')
|
50
60
|
expect($stderr.string).to eq('')
|
51
61
|
end
|
52
62
|
|
53
|
-
it
|
63
|
+
it 'imports over' do
|
54
64
|
$cfg['application.id'] = '12'
|
55
65
|
$cfg['product.id'] = 'awdfvs'
|
56
66
|
$cfg['user.name'] = '3qrarvsa'
|
@@ -66,18 +76,20 @@ RSpec.describe MrMurano::ConfigMigrate do
|
|
66
76
|
pff = $cfg.file_at('passwords', :user)
|
67
77
|
pwd = MrMurano::Passwords.new(pff)
|
68
78
|
pwd.load
|
69
|
-
expect(pwd.get$cfg['net.host'], $cfg['user.name']).to eq('gibblygook')
|
79
|
+
expect(pwd.get($cfg['net.host'], $cfg['user.name'])).to eq('gibblygook')
|
70
80
|
expect($stdout.string).to eq('')
|
71
81
|
expect($stderr.string).to eq('')
|
72
82
|
end
|
73
83
|
|
74
|
-
it
|
84
|
+
it 'Asks about password differences' do
|
75
85
|
pff = $cfg.file_at('passwords', :user)
|
76
86
|
pwd = MrMurano::Passwords.new(pff)
|
77
87
|
pwd.set($cfg['net.host'], 'test@user.account', 'bob')
|
78
88
|
pwd.save
|
79
89
|
|
80
|
-
expect($terminal).to receive(:ask).with(
|
90
|
+
expect($terminal).to receive(:ask).with(
|
91
|
+
'A different password for this account already exists. Overwrite? N/y'
|
92
|
+
).and_return('y')
|
81
93
|
|
82
94
|
@mrt.import_secret
|
83
95
|
|
@@ -87,10 +99,9 @@ RSpec.describe MrMurano::ConfigMigrate do
|
|
87
99
|
pff = $cfg.file_at('passwords', :user)
|
88
100
|
pwd = MrMurano::Passwords.new(pff)
|
89
101
|
pwd.load
|
90
|
-
expect(pwd.get$cfg['net.host'], $cfg['user.name']).to eq('gibblygook')
|
102
|
+
expect(pwd.get($cfg['net.host'], $cfg['user.name'])).to eq('gibblygook')
|
91
103
|
expect($stdout.string).to eq('')
|
92
104
|
expect($stderr.string).to eq('')
|
93
105
|
end
|
94
|
-
|
95
106
|
end
|
96
|
-
|
107
|
+
|
data/spec/Config_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 'erb'
|
2
9
|
require 'tempfile'
|
3
10
|
require 'MrMurano/version'
|
@@ -5,10 +12,9 @@ require 'MrMurano/Config'
|
|
5
12
|
require '_workspace'
|
6
13
|
|
7
14
|
RSpec.describe MrMurano::Config do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
it "Sets defaults" do
|
15
|
+
context 'Basics ' do
|
16
|
+
include_context 'WORKSPACE'
|
17
|
+
it 'Sets defaults' do
|
12
18
|
cfg = MrMurano::Config.new
|
13
19
|
cfg.load
|
14
20
|
# Don't check for all of them, just a few.
|
@@ -18,7 +24,7 @@ RSpec.describe MrMurano::Config do
|
|
18
24
|
expect(cfg.get('tool.debug', :defaults)).to eq(false)
|
19
25
|
end
|
20
26
|
|
21
|
-
it
|
27
|
+
it 'Sets internal values' do
|
22
28
|
cfg = MrMurano::Config.new
|
23
29
|
cfg.load
|
24
30
|
|
@@ -28,7 +34,7 @@ RSpec.describe MrMurano::Config do
|
|
28
34
|
expect(cfg.get('bob.test', :internal)).to eq('twelve')
|
29
35
|
end
|
30
36
|
|
31
|
-
it
|
37
|
+
it 'Sets tool values' do
|
32
38
|
cfg = MrMurano::Config.new
|
33
39
|
cfg.load
|
34
40
|
|
@@ -38,7 +44,7 @@ RSpec.describe MrMurano::Config do
|
|
38
44
|
expect(cfg.get('tool.test', :internal)).to eq('twelve')
|
39
45
|
end
|
40
46
|
|
41
|
-
it
|
47
|
+
it 'Sets project values' do # This should write
|
42
48
|
cfg = MrMurano::Config.new
|
43
49
|
cfg.load
|
44
50
|
|
@@ -55,7 +61,7 @@ RSpec.describe MrMurano::Config do
|
|
55
61
|
expect(cfg.get('bob.test', :project)).to eq('twelve')
|
56
62
|
end
|
57
63
|
|
58
|
-
it
|
64
|
+
it 'Sets a user value' do
|
59
65
|
cfg = MrMurano::Config.new
|
60
66
|
cfg.load
|
61
67
|
|
@@ -72,11 +78,11 @@ RSpec.describe MrMurano::Config do
|
|
72
78
|
expect(cfg.get('bob.test', :user)).to eq('twelve')
|
73
79
|
end
|
74
80
|
|
75
|
-
it
|
81
|
+
it 'loads from a specific file' do
|
76
82
|
File.open(@project_dir + '/foo.cfg', 'w') do |io|
|
77
|
-
io << %
|
83
|
+
io << %([test]
|
78
84
|
bob = test
|
79
|
-
|
85
|
+
).gsub(/^\s\+/, '')
|
80
86
|
end
|
81
87
|
|
82
88
|
cfg = MrMurano::Config.new
|
@@ -86,8 +92,8 @@ RSpec.describe MrMurano::Config do
|
|
86
92
|
expect(cfg['test.bob']).to eq('test')
|
87
93
|
end
|
88
94
|
|
89
|
-
context
|
90
|
-
it
|
95
|
+
context 'returns a path to a file in' do
|
96
|
+
it 'project mrmurano dir' do
|
91
97
|
cfg = MrMurano::Config.new
|
92
98
|
cfg.load
|
93
99
|
path = cfg.file_at('testfile').realdirpath
|
@@ -96,7 +102,7 @@ RSpec.describe MrMurano::Config do
|
|
96
102
|
expect(path).to eq(want)
|
97
103
|
end
|
98
104
|
|
99
|
-
it
|
105
|
+
it 'user mrmurano dir' do
|
100
106
|
cfg = MrMurano::Config.new
|
101
107
|
cfg.load
|
102
108
|
path = cfg.file_at('testfile', :user).realdirpath
|
@@ -105,7 +111,7 @@ RSpec.describe MrMurano::Config do
|
|
105
111
|
expect(path).to eq(want)
|
106
112
|
end
|
107
113
|
|
108
|
-
it
|
114
|
+
it 'internal' do
|
109
115
|
cfg = MrMurano::Config.new
|
110
116
|
cfg.load
|
111
117
|
path = cfg.file_at('testfile', :internal)
|
@@ -113,7 +119,7 @@ RSpec.describe MrMurano::Config do
|
|
113
119
|
expect(path).to eq(nil)
|
114
120
|
end
|
115
121
|
|
116
|
-
it
|
122
|
+
it 'specified' do
|
117
123
|
cfg = MrMurano::Config.new
|
118
124
|
cfg.load
|
119
125
|
path = cfg.file_at('testfile', :specified)
|
@@ -121,7 +127,7 @@ RSpec.describe MrMurano::Config do
|
|
121
127
|
expect(path).to eq(nil)
|
122
128
|
end
|
123
129
|
|
124
|
-
it
|
130
|
+
it 'defaults' do
|
125
131
|
cfg = MrMurano::Config.new
|
126
132
|
cfg.load
|
127
133
|
path = cfg.file_at('testfile', :defaults)
|
@@ -139,12 +145,12 @@ RSpec.describe MrMurano::Config do
|
|
139
145
|
ENV['MR_CONFIGFILE'] = nil
|
140
146
|
end
|
141
147
|
|
142
|
-
it
|
148
|
+
it 'loads file in env' do
|
143
149
|
ENV['MURANO_CONFIGFILE'] = @tmpdir + '/home/test.config'
|
144
150
|
File.open(@tmpdir + '/home/test.config', 'w') do |io|
|
145
|
-
io << %
|
151
|
+
io << %([test]
|
146
152
|
bob = test
|
147
|
-
|
153
|
+
).gsub(/^\s\+/, '')
|
148
154
|
end
|
149
155
|
|
150
156
|
cfg = MrMurano::Config.new
|
@@ -152,7 +158,7 @@ RSpec.describe MrMurano::Config do
|
|
152
158
|
expect(cfg['test.bob']).to eq('test')
|
153
159
|
end
|
154
160
|
|
155
|
-
it
|
161
|
+
it 'will create file at env' do
|
156
162
|
ENV['MURANO_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
157
163
|
cfg = MrMurano::Config.new
|
158
164
|
cfg.load
|
@@ -167,14 +173,14 @@ RSpec.describe MrMurano::Config do
|
|
167
173
|
expect(cfg.get('coffee.hot', :env)).to eq('yes')
|
168
174
|
end
|
169
175
|
|
170
|
-
it
|
176
|
+
it 'warns about migrating old ENV name' do
|
171
177
|
ENV['MURANO_CONFIGFILE'] = nil
|
172
178
|
ENV['MR_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
173
179
|
expect_any_instance_of(MrMurano::Config).to receive(:warning).once
|
174
180
|
MrMurano::Config.new
|
175
181
|
end
|
176
182
|
|
177
|
-
it
|
183
|
+
it 'errors if both are defined' do
|
178
184
|
ENV['MURANO_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
179
185
|
ENV['MR_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
180
186
|
# 2 warnings:
|
@@ -187,7 +193,7 @@ RSpec.describe MrMurano::Config do
|
|
187
193
|
end
|
188
194
|
end
|
189
195
|
|
190
|
-
it
|
196
|
+
it 'dumps' do
|
191
197
|
@saved_cfg = ENV['MURANO_CONFIGFILE']
|
192
198
|
ENV['MURANO_CONFIGFILE'] = nil
|
193
199
|
cfg = MrMurano::Config.new
|
@@ -203,36 +209,34 @@ RSpec.describe MrMurano::Config do
|
|
203
209
|
ENV['MURANO_CONFIGFILE'] = @saved_cfg
|
204
210
|
end
|
205
211
|
|
206
|
-
context
|
207
|
-
it
|
212
|
+
context 'fixing permissions' do
|
213
|
+
it 'fixes a directory' do
|
208
214
|
Dir.mkdir('test')
|
209
215
|
cfg = MrMurano::Config.new
|
210
216
|
cfg.fix_modes(Pathname.new('test'))
|
211
|
-
if Gem.win_platform?
|
212
|
-
expect(FileTest.world_readable?
|
213
|
-
expect(FileTest.world_writable? 'test').to be_nil
|
217
|
+
if Gem.win_platform?
|
218
|
+
expect(FileTest.world_readable?('test')).to eq(493)
|
214
219
|
else
|
215
|
-
expect(FileTest.world_readable?
|
216
|
-
expect(FileTest.world_writable? 'test').to be_nil
|
220
|
+
expect(FileTest.world_readable?('test')).to be_nil
|
217
221
|
end
|
222
|
+
expect(FileTest.world_writable?('test')).to be_nil
|
218
223
|
end
|
219
224
|
|
220
|
-
it
|
225
|
+
it 'fixes a file' do
|
221
226
|
FileUtils.touch('test')
|
222
227
|
cfg = MrMurano::Config.new
|
223
228
|
cfg.fix_modes(Pathname.new('test'))
|
224
|
-
if Gem.win_platform?
|
225
|
-
expect(FileTest.world_readable?
|
226
|
-
expect(FileTest.world_writable? 'test').to be_nil
|
229
|
+
if Gem.win_platform?
|
230
|
+
expect(FileTest.world_readable?('test')).to eq(420)
|
227
231
|
else
|
228
|
-
expect(FileTest.world_readable?
|
229
|
-
expect(FileTest.world_writable? 'test').to be_nil
|
232
|
+
expect(FileTest.world_readable?('test')).to be_nil
|
230
233
|
end
|
234
|
+
expect(FileTest.world_writable?('test')).to be_nil
|
231
235
|
end
|
232
236
|
end
|
233
237
|
end
|
234
238
|
|
235
|
-
context
|
239
|
+
context 'Can find the project directory by .murano/config' do
|
236
240
|
before(:example) do
|
237
241
|
@tmpdir = Dir.tmpdir
|
238
242
|
path = '/home/work/project/some/where'
|
@@ -249,7 +253,7 @@ RSpec.describe MrMurano::Config do
|
|
249
253
|
FileUtils.remove_dir(@tmpdir + '/home', true) if FileTest.exist? @tmpdir
|
250
254
|
end
|
251
255
|
|
252
|
-
it
|
256
|
+
it 'when in project directory' do
|
253
257
|
Dir.chdir(@project_dir) do
|
254
258
|
cfg = MrMurano::Config.new
|
255
259
|
cfg.load
|
@@ -260,7 +264,7 @@ RSpec.describe MrMurano::Config do
|
|
260
264
|
end
|
261
265
|
end
|
262
266
|
|
263
|
-
it
|
267
|
+
it 'when in sub directory' do
|
264
268
|
Dir.chdir(@project_dir + '/some/where') do
|
265
269
|
cfg = MrMurano::Config.new
|
266
270
|
cfg.load
|
@@ -271,7 +275,7 @@ RSpec.describe MrMurano::Config do
|
|
271
275
|
end
|
272
276
|
end
|
273
277
|
|
274
|
-
it
|
278
|
+
it 'when .murano is in both PWD and parent dir' do
|
275
279
|
Dir.chdir(@project_dir + '/some') do
|
276
280
|
FileUtils.mkpath('.murano')
|
277
281
|
FileUtils.touch('.murano/config')
|
@@ -285,7 +289,7 @@ RSpec.describe MrMurano::Config do
|
|
285
289
|
end
|
286
290
|
end
|
287
291
|
|
288
|
-
context
|
292
|
+
context 'Can find the project directory by .murano/' do
|
289
293
|
before(:example) do
|
290
294
|
@tmpdir = Dir.tmpdir
|
291
295
|
path = '/home/work/project/some/where'
|
@@ -301,7 +305,7 @@ RSpec.describe MrMurano::Config do
|
|
301
305
|
FileUtils.remove_dir(@tmpdir + '/home', true) if FileTest.exist? @tmpdir
|
302
306
|
end
|
303
307
|
|
304
|
-
it
|
308
|
+
it 'when in project directory' do
|
305
309
|
Dir.chdir(@project_dir) do
|
306
310
|
cfg = MrMurano::Config.new
|
307
311
|
cfg.load
|
@@ -312,7 +316,7 @@ RSpec.describe MrMurano::Config do
|
|
312
316
|
end
|
313
317
|
end
|
314
318
|
|
315
|
-
it
|
319
|
+
it 'when in sub directory' do
|
316
320
|
Dir.chdir(@project_dir + '/some/where') do
|
317
321
|
cfg = MrMurano::Config.new
|
318
322
|
cfg.load
|
@@ -323,7 +327,7 @@ RSpec.describe MrMurano::Config do
|
|
323
327
|
end
|
324
328
|
end
|
325
329
|
|
326
|
-
it
|
330
|
+
it 'when .murano is in both PWD and parent dir' do
|
327
331
|
Dir.chdir(@project_dir + '/some') do
|
328
332
|
FileUtils.mkpath('.murano')
|
329
333
|
cfg = MrMurano::Config.new
|
@@ -336,7 +340,7 @@ RSpec.describe MrMurano::Config do
|
|
336
340
|
end
|
337
341
|
end
|
338
342
|
|
339
|
-
context
|
343
|
+
context 'When pwd is $HOME:' do
|
340
344
|
before(:example) do
|
341
345
|
@tmpdir = Dir.tmpdir
|
342
346
|
@project_dir = @tmpdir + '/home/work/project'
|
@@ -349,7 +353,7 @@ RSpec.describe MrMurano::Config do
|
|
349
353
|
FileUtils.remove_dir(@tmpdir + '/home', true) if FileTest.exist? @tmpdir
|
350
354
|
end
|
351
355
|
|
352
|
-
it
|
356
|
+
it 'Sets a user value' do
|
353
357
|
Dir.chdir(ENV['HOME']) do
|
354
358
|
cfg = MrMurano::Config.new
|
355
359
|
cfg.load
|
@@ -368,7 +372,7 @@ RSpec.describe MrMurano::Config do
|
|
368
372
|
end
|
369
373
|
end
|
370
374
|
|
371
|
-
it
|
375
|
+
it 'Sets project values' do # This should write
|
372
376
|
Dir.chdir(ENV['HOME']) do
|
373
377
|
cfg = MrMurano::Config.new
|
374
378
|
cfg.load
|
@@ -387,7 +391,7 @@ RSpec.describe MrMurano::Config do
|
|
387
391
|
end
|
388
392
|
end
|
389
393
|
|
390
|
-
it
|
394
|
+
it 'write a project value and reads it as a user value' do
|
391
395
|
Dir.chdir(ENV['HOME']) do
|
392
396
|
cfg = MrMurano::Config.new
|
393
397
|
cfg.load
|
@@ -408,17 +412,17 @@ RSpec.describe MrMurano::Config do
|
|
408
412
|
end
|
409
413
|
end
|
410
414
|
|
411
|
-
context
|
412
|
-
include_context
|
415
|
+
context 'Warns about migrating old' do
|
416
|
+
include_context 'WORKSPACE'
|
413
417
|
|
414
|
-
it
|
418
|
+
it 'config file name' do
|
415
419
|
FileUtils.touch(@project_dir + '/.mrmuranorc')
|
416
420
|
expect_any_instance_of(MrMurano::Config).to receive(:warning).once
|
417
421
|
cfg = MrMurano::Config.new
|
418
422
|
cfg.validate_cmd
|
419
423
|
end
|
420
424
|
|
421
|
-
it
|
425
|
+
it 'config directory name' do
|
422
426
|
FileUtils.mkpath(@project_dir + '/.mrmurano')
|
423
427
|
expect_any_instance_of(MrMurano::Config).to receive(:warning).once
|
424
428
|
cfg = MrMurano::Config.new
|
@@ -427,4 +431,3 @@ RSpec.describe MrMurano::Config do
|
|
427
431
|
end
|
428
432
|
end
|
429
433
|
|
430
|
-
# vim: set ai et sw=2 ts=2 :
|
data/spec/Content_spec.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# Last Modified: 2017.09.13 /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 'fileutils'
|
2
9
|
require 'MrMurano/version'
|
3
10
|
require 'MrMurano/Content'
|
@@ -5,7 +12,7 @@ require 'MrMurano/SyncRoot'
|
|
5
12
|
require '_workspace'
|
6
13
|
|
7
14
|
RSpec.describe MrMurano::Content::Base do
|
8
|
-
include_context
|
15
|
+
include_context 'WORKSPACE'
|
9
16
|
before(:example) do
|
10
17
|
MrMurano::SyncRoot.instance.reset
|
11
18
|
$cfg = MrMurano::Config.new
|
@@ -14,163 +21,175 @@ RSpec.describe MrMurano::Content::Base do
|
|
14
21
|
$cfg['product.id'] = 'XYZ'
|
15
22
|
|
16
23
|
@ct = MrMurano::Content::Base.new
|
17
|
-
allow(@ct).to receive(:token).and_return(
|
24
|
+
allow(@ct).to receive(:token).and_return('TTTTTTTTTT')
|
18
25
|
end
|
19
26
|
|
20
|
-
it
|
27
|
+
it 'initializes' do
|
21
28
|
uri = @ct.endpoint('/')
|
22
|
-
expect(uri.to_s).to eq(
|
29
|
+
expect(uri.to_s).to eq('https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/')
|
23
30
|
end
|
24
31
|
|
25
|
-
it
|
32
|
+
it 'lists' do
|
26
33
|
body = [{
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
}]
|
34
|
+
type: 'binary/octet-stream',
|
35
|
+
length: 5622,
|
36
|
+
last_modified: '2017-02-10T17:43:45.000Z',
|
37
|
+
id: 'TODO.taskpaper',
|
38
|
+
},]
|
32
39
|
|
33
|
-
stub_request(:get,
|
34
|
-
to_return(:
|
40
|
+
stub_request(:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item?full=true')
|
41
|
+
.to_return(body: body.to_json)
|
35
42
|
|
36
43
|
ret = @ct.list
|
37
44
|
expect(ret).to eq(body)
|
38
45
|
end
|
39
46
|
|
40
|
-
it
|
41
|
-
stub_request(:delete,
|
47
|
+
it 'clears all' do
|
48
|
+
stub_request(:delete, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item')
|
42
49
|
ret = @ct.clear_all
|
43
50
|
expect(ret).to eq({})
|
44
51
|
end
|
45
52
|
|
46
|
-
it
|
53
|
+
it 'fetches info for one' do
|
47
54
|
body = {
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
55
|
+
type: 'binary/octet-stream',
|
56
|
+
length: 5622,
|
57
|
+
last_modified: '2017-02-10T17:43:45.000Z',
|
58
|
+
id: 'TODO.taskpaper',
|
52
59
|
}
|
53
60
|
|
54
|
-
stub_request(
|
55
|
-
|
61
|
+
stub_request(
|
62
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper'
|
63
|
+
).to_return(body: body.to_json)
|
56
64
|
|
57
65
|
ret = @ct.fetch('TODO.taskpaper')
|
58
66
|
expect(ret).to eq(body)
|
59
67
|
end
|
60
68
|
|
61
|
-
it
|
62
|
-
stub_request(
|
69
|
+
it 'removes one' do
|
70
|
+
stub_request(
|
71
|
+
:delete, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper'
|
72
|
+
)
|
63
73
|
|
64
74
|
ret = @ct.remove('TODO.taskpaper')
|
65
75
|
expect(ret).to eq({})
|
66
76
|
end
|
67
77
|
|
68
|
-
context
|
78
|
+
context 'uploads' do
|
69
79
|
before(:example) do
|
70
80
|
@tup = Pathname.new(@project_dir) + 'Solutionfile.json'
|
71
81
|
FileUtils.copy(File.join(@testdir, 'spec/fixtures/SolutionFiles/basic.json'), @tup.to_path)
|
72
82
|
end
|
73
83
|
|
74
|
-
it
|
84
|
+
it 'uploads file' do
|
75
85
|
body = {
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
86
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
87
|
+
method: 'POST',
|
88
|
+
inputs: {
|
89
|
+
:'x-amz-meta-name' => 'Solutionfile.json',
|
90
|
+
:'x-amz-signature' => 'Bunch of Hex',
|
91
|
+
:'x-amz-date' => '20170214T200752Z',
|
92
|
+
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
93
|
+
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
94
|
+
policy: 'something base64 encoded.',
|
95
|
+
key: 'XXX/ZZZ',
|
96
|
+
acl: 'authenticated-read',
|
87
97
|
},
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
98
|
+
id: 'more Hex',
|
99
|
+
field: 'file',
|
100
|
+
enctype: 'multipart/form-data',
|
91
101
|
}
|
92
|
-
stub_request(
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
:
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
stub_request(
|
103
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
104
|
+
).with(
|
105
|
+
query: {
|
106
|
+
expires_in: 30,
|
107
|
+
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
108
|
+
type: 'application/json',
|
109
|
+
}
|
110
|
+
).to_return(body: body.to_json)
|
111
|
+
|
112
|
+
stub_request(
|
113
|
+
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
114
|
+
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
115
|
+
request.body =~ /something base64 encoded/
|
116
|
+
end.to_return(status: 200)
|
104
117
|
|
105
118
|
@ct.upload('Solutionfile.json', @tup.to_path)
|
106
119
|
end
|
107
120
|
|
108
|
-
it
|
121
|
+
it 'uploads with tags' do
|
109
122
|
body = {
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
123
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
124
|
+
method: 'POST',
|
125
|
+
inputs: {
|
126
|
+
:'x-amz-meta-name' => 'Solutionfile.json',
|
127
|
+
:'x-amz-signature' => 'Bunch of Hex',
|
128
|
+
:'x-amz-date' => '20170214T200752Z',
|
129
|
+
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
130
|
+
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
131
|
+
policy: 'something base64 encoded.',
|
132
|
+
key: 'XXX/ZZZ',
|
133
|
+
acl: 'authenticated-read',
|
121
134
|
},
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
135
|
+
id: 'more Hex',
|
136
|
+
field: 'file',
|
137
|
+
enctype: 'multipart/form-data',
|
125
138
|
}
|
126
|
-
tags = {:
|
127
|
-
stub_request(
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
:
|
132
|
-
:
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
139
|
+
tags = { one: 12, four: 'bob' }
|
140
|
+
stub_request(
|
141
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
142
|
+
).with(
|
143
|
+
query: {
|
144
|
+
expires_in: 30,
|
145
|
+
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
146
|
+
type: 'application/json',
|
147
|
+
tags: tags.to_json,
|
148
|
+
}
|
149
|
+
).to_return(body: body.to_json)
|
150
|
+
|
151
|
+
stub_request(
|
152
|
+
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
153
|
+
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
154
|
+
request.body =~ /something base64 encoded/
|
155
|
+
end.to_return(status: 200)
|
140
156
|
|
141
157
|
@ct.upload('Solutionfile.json', @tup.to_path, tags)
|
142
158
|
end
|
143
159
|
|
144
|
-
it
|
160
|
+
it 'uploads fail at S3' do
|
145
161
|
body = {
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
162
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
163
|
+
method: 'POST',
|
164
|
+
inputs: {
|
165
|
+
:'x-amz-meta-name' => 'Solutionfile.json',
|
166
|
+
:'x-amz-signature' => 'Bunch of Hex',
|
167
|
+
:'x-amz-date' => '20170214T200752Z',
|
168
|
+
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
169
|
+
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
170
|
+
policy: 'something base64 encoded.',
|
171
|
+
key: 'XXX/ZZZ',
|
172
|
+
acl: 'authenticated-read',
|
157
173
|
},
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
174
|
+
id: 'more Hex',
|
175
|
+
field: 'file',
|
176
|
+
enctype: 'multipart/form-data',
|
161
177
|
}
|
162
|
-
stub_request(
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
:
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
178
|
+
stub_request(
|
179
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
180
|
+
).with(
|
181
|
+
query: {
|
182
|
+
expires_in: 30,
|
183
|
+
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
184
|
+
type: 'application/json',
|
185
|
+
}
|
186
|
+
).to_return(body: body.to_json)
|
187
|
+
|
188
|
+
stub_request(
|
189
|
+
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
190
|
+
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
191
|
+
request.body =~ /something base64 encoded/
|
192
|
+
end.to_return(status: 500)
|
174
193
|
|
175
194
|
saved = $stderr
|
176
195
|
$stderr = StringIO.new
|
@@ -180,65 +199,71 @@ RSpec.describe MrMurano::Content::Base do
|
|
180
199
|
$stderr = saved
|
181
200
|
end
|
182
201
|
|
183
|
-
it
|
202
|
+
it 'uploads with --dry' do
|
184
203
|
body = {
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
190
|
-
:
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
204
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
205
|
+
method: 'POST',
|
206
|
+
inputs: {
|
207
|
+
:'x-amz-meta-name' => 'resources.yaml',
|
208
|
+
:'x-amz-signature' => 'Bunch of Hex',
|
209
|
+
:'x-amz-date' => '20170214T200752Z',
|
210
|
+
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
211
|
+
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
212
|
+
policy: 'something base64 encoded.',
|
213
|
+
key: 'XXX/ZZZ',
|
214
|
+
acl: 'authenticated-read',
|
196
215
|
},
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
216
|
+
id: 'more Hex',
|
217
|
+
field: 'file',
|
218
|
+
enctype: 'multipart/form-data',
|
200
219
|
}
|
201
|
-
stub_request(
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
:
|
206
|
-
|
220
|
+
stub_request(
|
221
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
222
|
+
).with(
|
223
|
+
query: {
|
224
|
+
expires_in: 30,
|
225
|
+
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
226
|
+
type: 'application/json',
|
227
|
+
}
|
228
|
+
).to_return(body: body.to_json)
|
207
229
|
|
208
230
|
$cfg['tool.dry'] = true
|
209
231
|
@ct.upload('Solutionfile.json', @tup.to_path)
|
210
232
|
end
|
211
233
|
|
212
|
-
it
|
234
|
+
it 'uploads with --curl' do
|
213
235
|
body = {
|
214
|
-
:
|
215
|
-
:
|
216
|
-
:
|
217
|
-
:
|
218
|
-
:
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
:
|
224
|
-
:
|
236
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
237
|
+
method: 'POST',
|
238
|
+
inputs: {
|
239
|
+
:'x-amz-meta-name' => 'Solutionfile.json',
|
240
|
+
:'x-amz-signature' => 'Bunch of Hex',
|
241
|
+
:'x-amz-date' => '20170214T200752Z',
|
242
|
+
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
243
|
+
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
244
|
+
policy: 'something base64 encoded.',
|
245
|
+
key: 'XXX/ZZZ',
|
246
|
+
acl: 'authenticated-read',
|
225
247
|
},
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
248
|
+
id: 'more Hex',
|
249
|
+
field: 'file',
|
250
|
+
enctype: 'multipart/form-data',
|
229
251
|
}
|
230
|
-
stub_request(
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
:
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
252
|
+
stub_request(
|
253
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
254
|
+
).with(
|
255
|
+
query: {
|
256
|
+
expires_in: 30,
|
257
|
+
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
258
|
+
type: 'application/json',
|
259
|
+
}
|
260
|
+
).to_return(body: body.to_json)
|
261
|
+
|
262
|
+
stub_request(
|
263
|
+
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
264
|
+
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
265
|
+
request.body =~ /something base64 encoded/
|
266
|
+
end.to_return(status: 200)
|
242
267
|
|
243
268
|
saved = $stdout
|
244
269
|
$stdout = StringIO.new
|
@@ -251,19 +276,21 @@ RSpec.describe MrMurano::Content::Base do
|
|
251
276
|
end
|
252
277
|
end
|
253
278
|
|
254
|
-
context
|
255
|
-
it
|
279
|
+
context 'downloads' do
|
280
|
+
it 'something to stdout' do
|
256
281
|
body = {
|
257
|
-
:
|
258
|
-
:
|
259
|
-
:
|
282
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
283
|
+
method: 'GET',
|
284
|
+
id: '8076e5d091844814d7f5cd97a1a730aa',
|
260
285
|
}
|
261
286
|
|
262
|
-
stub_request(
|
263
|
-
|
287
|
+
stub_request(
|
288
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
289
|
+
).to_return(body: body.to_json)
|
264
290
|
|
265
|
-
stub_request(
|
266
|
-
|
291
|
+
stub_request(
|
292
|
+
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
293
|
+
).to_return(body: 'FOOOOOOOOOOOO')
|
267
294
|
|
268
295
|
# This test does not work with curldebug enabled.
|
269
296
|
$cfg['tool.curldebug'] = false
|
@@ -273,43 +300,47 @@ RSpec.describe MrMurano::Content::Base do
|
|
273
300
|
$stdout = StringIO.new
|
274
301
|
|
275
302
|
@ct.download('TODO.taskpaper')
|
276
|
-
expect($stdout.string).to eq(
|
303
|
+
expect($stdout.string).to eq('FOOOOOOOOOOOO')
|
277
304
|
$stdout = saved
|
278
305
|
end
|
279
306
|
|
280
|
-
it
|
307
|
+
it 'something to block' do
|
281
308
|
body = {
|
282
|
-
:
|
283
|
-
:
|
284
|
-
:
|
309
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
310
|
+
method: 'GET',
|
311
|
+
id: '8076e5d091844814d7f5cd97a1a730aa',
|
285
312
|
}
|
286
313
|
|
287
|
-
stub_request(
|
288
|
-
|
314
|
+
stub_request(
|
315
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
316
|
+
).to_return(body: body.to_json)
|
289
317
|
|
290
|
-
stub_request(
|
291
|
-
|
318
|
+
stub_request(
|
319
|
+
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
320
|
+
).to_return(body: 'FOOOOOOOOOOOO')
|
292
321
|
|
293
|
-
expect{|b| @ct.download('TODO.taskpaper', &b) }.to yield_with_args(
|
322
|
+
expect { |b| @ct.download('TODO.taskpaper', &b) }.to yield_with_args('FOOOOOOOOOOOO')
|
294
323
|
end
|
295
324
|
|
296
325
|
it "something that isn't there" do
|
297
326
|
# bizapi/content/download always returns GET instructions? yes.
|
298
327
|
body = {
|
299
|
-
:
|
300
|
-
:
|
301
|
-
:
|
328
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
329
|
+
method: 'GET',
|
330
|
+
id: '8076e5d091844814d7f5cd97a1a730aa',
|
302
331
|
}
|
303
332
|
|
304
|
-
stub_request(
|
305
|
-
|
333
|
+
stub_request(
|
334
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Notthere/download'
|
335
|
+
).to_return(body: body.to_json)
|
306
336
|
|
307
|
-
resp = %
|
308
|
-
<?xml version=
|
337
|
+
resp = %(
|
338
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
309
339
|
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>XXX/ZZZ</Key><RequestId>12</RequestId><HostId>=</HostId></Error>
|
310
|
-
|
311
|
-
stub_request(
|
312
|
-
|
340
|
+
)
|
341
|
+
stub_request(
|
342
|
+
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
343
|
+
).to_return(status: 404, body: resp)
|
313
344
|
|
314
345
|
saved = $stderr
|
315
346
|
$stderr = StringIO.new
|
@@ -320,18 +351,20 @@ RSpec.describe MrMurano::Content::Base do
|
|
320
351
|
$stderr = saved
|
321
352
|
end
|
322
353
|
|
323
|
-
it
|
354
|
+
it 'something to block with --curl' do
|
324
355
|
body = {
|
325
|
-
:
|
326
|
-
:
|
327
|
-
:
|
356
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
357
|
+
method: 'GET',
|
358
|
+
id: '8076e5d091844814d7f5cd97a1a730aa',
|
328
359
|
}
|
329
360
|
|
330
|
-
stub_request(
|
331
|
-
|
361
|
+
stub_request(
|
362
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
363
|
+
).to_return(body: body.to_json)
|
332
364
|
|
333
|
-
stub_request(
|
334
|
-
|
365
|
+
stub_request(
|
366
|
+
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
367
|
+
).to_return(body: 'FOOOOOOOOOOOO')
|
335
368
|
|
336
369
|
saved = $stdout
|
337
370
|
$stdout = StringIO.new
|
@@ -343,21 +376,20 @@ RSpec.describe MrMurano::Content::Base do
|
|
343
376
|
$stdout = saved
|
344
377
|
end
|
345
378
|
|
346
|
-
it
|
379
|
+
it 'something to block with --dry' do
|
347
380
|
body = {
|
348
|
-
:
|
349
|
-
:
|
350
|
-
:
|
381
|
+
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
382
|
+
method: 'GET',
|
383
|
+
id: '8076e5d091844814d7f5cd97a1a730aa',
|
351
384
|
}
|
352
385
|
|
353
|
-
stub_request(
|
354
|
-
|
386
|
+
stub_request(
|
387
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
388
|
+
).to_return(body: body.to_json)
|
355
389
|
|
356
390
|
$cfg['tool.dry'] = true
|
357
391
|
@ct.download('TODO.taskpaper')
|
358
|
-
|
359
392
|
end
|
360
393
|
end
|
361
|
-
|
362
394
|
end
|
363
|
-
|
395
|
+
|