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/cmd_business_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Last Modified: 2017.
|
2
|
-
# frozen_string_literal:
|
1
|
+
# Last Modified: 2017.09.12 /coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# Copyright © 2016-2017 Exosite LLC.
|
5
5
|
# License: MIT. See LICENSE.txt.
|
@@ -11,18 +11,18 @@ require 'pathname'
|
|
11
11
|
require 'cmd_common'
|
12
12
|
|
13
13
|
RSpec.describe 'murano business', :cmd, :needs_password do
|
14
|
-
include_context
|
14
|
+
include_context 'CI_CMD'
|
15
15
|
|
16
|
-
context
|
17
|
-
it
|
16
|
+
context 'without project' do
|
17
|
+
it 'help' do
|
18
18
|
cmd_verify_help('business')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
context
|
23
|
-
it
|
22
|
+
context 'list' do
|
23
|
+
it 'as table' do
|
24
24
|
out, err, status = Open3.capture3(capcmd('murano', 'business', 'list'))
|
25
|
-
expect(err).to eq(
|
25
|
+
expect(err).to eq('')
|
26
26
|
olines = out.lines
|
27
27
|
expect(olines[0]).to match(/^(\+-+){3}\+$/)
|
28
28
|
expect(olines[1]).to match(/^\| bizid\s+\| role\s+\| name\s+\|$/)
|
@@ -31,23 +31,23 @@ RSpec.describe 'murano business', :cmd, :needs_password do
|
|
31
31
|
expect(status.exitstatus).to eq(0)
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'as json' do
|
35
35
|
out, err, status = Open3.capture3(capcmd('murano', 'business', 'list', '-c', 'outformat=json'))
|
36
|
-
expect(err).to eq(
|
37
|
-
expect{ JSON.parse(out) }.to_not raise_error
|
36
|
+
expect(err).to eq('')
|
37
|
+
expect { JSON.parse(out) }.to_not raise_error
|
38
38
|
expect(status.exitstatus).to eq(0)
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
41
|
+
it 'only ids' do
|
42
42
|
out, err, status = Open3.capture3(capcmd('murano', 'business', 'list', '--idonly'))
|
43
|
-
expect(err).to eq(
|
43
|
+
expect(err).to eq('')
|
44
44
|
expect(out).to match(/^(\S+\s)*\S+$/)
|
45
45
|
expect(status.exitstatus).to eq(0)
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it 'output to file' do
|
49
49
|
out, err, status = Open3.capture3(capcmd('murano', 'business', 'list', '--idonly', '-o', 'bob'))
|
50
|
-
expect(err).to eq(
|
50
|
+
expect(err).to eq('')
|
51
51
|
expect(out).to eq('')
|
52
52
|
expect(status.exitstatus).to eq(0)
|
53
53
|
expect(File.exist?('bob')).to be true
|
@@ -55,9 +55,9 @@ RSpec.describe 'murano business', :cmd, :needs_password do
|
|
55
55
|
expect(data).to match(/^(\S+\s)*\S+$/)
|
56
56
|
end
|
57
57
|
|
58
|
-
it
|
58
|
+
it 'fewer fields' do
|
59
59
|
out, err, status = Open3.capture3(capcmd('murano', 'business', 'list', '--brief'))
|
60
|
-
expect(err).to eq(
|
60
|
+
expect(err).to eq('')
|
61
61
|
olines = out.lines
|
62
62
|
expect(olines[0]).to match(/^(\+-+)+\+$/)
|
63
63
|
expect(olines[1]).to match(/^(\| \S+\s+)+\|$/)
|
data/spec/cmd_common.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Last Modified: 2017.
|
1
|
+
# Last Modified: 2017.09.12 /coding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# Copyright © 2016-2017 Exosite LLC.
|
@@ -8,6 +8,7 @@
|
|
8
8
|
require 'highline'
|
9
9
|
# Set HighLine's $terminal global.
|
10
10
|
require 'highline/import'
|
11
|
+
require 'os'
|
11
12
|
require 'pathname'
|
12
13
|
require 'shellwords'
|
13
14
|
require 'timeout'
|
@@ -27,13 +28,13 @@ at_exit do
|
|
27
28
|
STDERR.puts('¡!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
28
29
|
end
|
29
30
|
end
|
30
|
-
alias original_at_exit at_exit
|
31
|
+
alias original_at_exit at_exit unless defined?(original_at_exit)
|
31
32
|
def at_exit(*args, &block)
|
32
33
|
#original_at_exit *args, &block
|
33
34
|
# pass!
|
34
35
|
end
|
35
36
|
|
36
|
-
require 'MrMurano/
|
37
|
+
require 'MrMurano/Commander-Entry'
|
37
38
|
|
38
39
|
module Commander
|
39
40
|
class Command
|
@@ -107,8 +108,10 @@ RSpec.shared_context 'CI_CMD' do
|
|
107
108
|
# This happens on Windows...
|
108
109
|
require 'rbconfig'
|
109
110
|
# Check the platform, e.g., "linux-gnu", or other.
|
110
|
-
is_windows = (
|
111
|
-
|
111
|
+
#is_windows = (
|
112
|
+
# RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
113
|
+
#)
|
114
|
+
unless OS.windows?
|
112
115
|
$stderr.puts(
|
113
116
|
'Unexpected: ln_s failed on non-Windows machine / ' \
|
114
117
|
"host_os: #{RbConfig::CONFIG['host_os']} / err: #{err}"
|
@@ -164,8 +167,8 @@ RSpec.shared_context 'CI_CMD' do
|
|
164
167
|
out, err, status = Open3.capture3(capcmd('murano', 'assign', 'set'))
|
165
168
|
#expect(out).to a_string_starting_with("Linked product #{@proj_name_prod}")
|
166
169
|
olines = out.lines
|
167
|
-
expect(olines[0]
|
168
|
-
"Linked
|
170
|
+
expect(strip_fancy(olines[0])).to eq(
|
171
|
+
"Linked '#{@proj_name_prod}' to '#{@proj_name_appy}'\n"
|
169
172
|
)
|
170
173
|
expect(olines[1]).to eq("Created default event handler\n")
|
171
174
|
expect(err).to eq('')
|
@@ -208,6 +211,23 @@ RSpec.shared_context 'CI_CMD' do
|
|
208
211
|
str.gsub(/\e\[(\d+)m/, '')
|
209
212
|
end
|
210
213
|
|
214
|
+
def strip_fancy(str)
|
215
|
+
# Windows has a complaint about the fancy quotes if you don't encode!, which is
|
216
|
+
#
|
217
|
+
# expected: "Linked \u2018syncdowntestprd1e8b4034\u2019
|
218
|
+
# to \u2018syncdowntestapp23d5135b\u2019\n"
|
219
|
+
# got: "Linked \xE2\x80\x98syncdowntestprd1e8b4034\xE2\x80\x99
|
220
|
+
# to \xE2\x80\x98syncdowntestapp23d5135b\xE2\x80\x99\n"
|
221
|
+
#
|
222
|
+
# or, to put it another way,
|
223
|
+
#
|
224
|
+
# -Linked ?syncdowntestprd1e8b4034? to ?syncdowntestapp23d5135b?
|
225
|
+
# +Linked ΓÇÿsyncdowntestprd1e8b4034ΓÇÖ to ΓÇÿsyncdowntestapp23d5135bΓÇÖ
|
226
|
+
#
|
227
|
+
# which we can solve with an encode call. (Or but using norm quotes.)
|
228
|
+
str.encode!('UTF-8', 'UTF-8').tr(%(‘), %(')).tr(%(’), %('))
|
229
|
+
end
|
230
|
+
|
211
231
|
# *** rb-commander goodies
|
212
232
|
|
213
233
|
def murano_command_run(cmd, *args)
|
data/spec/cmd_config_spec.rb
CHANGED
@@ -1,20 +1,27 @@
|
|
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 'fileutils'
|
2
9
|
require 'open3'
|
3
10
|
require 'pathname'
|
4
11
|
require 'cmd_common'
|
5
12
|
|
6
13
|
RSpec.describe 'murano config', :cmd do
|
7
|
-
include_context
|
14
|
+
include_context 'CI_CMD'
|
8
15
|
|
9
|
-
it
|
10
|
-
out, err, status = Open3.capture3(capcmd('murano',
|
16
|
+
it 'Needs a key' do
|
17
|
+
out, err, status = Open3.capture3(capcmd('murano', 'config'))
|
11
18
|
expect(status).to eq(0)
|
12
19
|
expect(out).to eq("\e[31mNeed a config key\e[0m\n")
|
13
20
|
expect(err).to eq('')
|
14
21
|
end
|
15
22
|
|
16
|
-
it
|
17
|
-
out, err, status = Open3.capture3(capcmd(%w
|
23
|
+
it 'Sets a key' do
|
24
|
+
out, err, status = Open3.capture3(capcmd(%w[murano config bob build]))
|
18
25
|
expect(out).to eq('')
|
19
26
|
expect(err).to eq('')
|
20
27
|
expect(status).to eq(0)
|
@@ -24,36 +31,41 @@ RSpec.describe 'murano config', :cmd do
|
|
24
31
|
expect(afile).to eq(bfile)
|
25
32
|
end
|
26
33
|
|
27
|
-
it
|
28
|
-
|
29
|
-
File.unlink(
|
30
|
-
out, err, status = Open3.capture3(capcmd(%w
|
34
|
+
it 'Sets a user key' do
|
35
|
+
user_cfg = File.join(ENV['HOME'], '.murano', 'config')
|
36
|
+
File.unlink(user_cfg) if File.exist? user_cfg
|
37
|
+
out, err, status = Open3.capture3(capcmd(%w[murano config bob build --user]))
|
31
38
|
expect(status).to eq(0)
|
32
39
|
expect(out).to eq('')
|
33
40
|
expect(err).to eq('')
|
34
41
|
|
35
|
-
afile = IO.read(
|
42
|
+
afile = IO.read(user_cfg)
|
36
43
|
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
37
44
|
expect(afile).to eq(bfile)
|
38
45
|
end
|
39
46
|
|
40
|
-
it
|
47
|
+
it 'Reads a key' do
|
41
48
|
FileUtils.mkpath(File.join(@tmpdir, '.murano'))
|
42
|
-
FileUtils.copy_file(
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
FileUtils.copy_file(
|
50
|
+
(@testdir + 'spec' + 'fixtures' + '.mrmuranorc').to_s,
|
51
|
+
File.join(@tmpdir, '.murano', 'config'),
|
52
|
+
verbose: true
|
53
|
+
)
|
54
|
+
out, err, status = Open3.capture3(capcmd(%w[murano config --project doThisTest.bob]))
|
46
55
|
expect(status).to eq(0)
|
47
56
|
expect(out).to eq("build\n")
|
48
57
|
expect(err).to eq('')
|
49
58
|
end
|
50
59
|
|
51
|
-
it
|
60
|
+
it 'Removes a key' do
|
52
61
|
FileUtils.mkpath(File.join(@tmpdir, '.murano'))
|
53
62
|
rcf = File.join(@tmpdir, '.murano', 'config')
|
54
|
-
FileUtils.copy_file(
|
55
|
-
|
56
|
-
|
63
|
+
FileUtils.copy_file(
|
64
|
+
(@testdir + 'spec' + 'fixtures' + '.mrmuranorc').to_s,
|
65
|
+
rcf,
|
66
|
+
verbose: true
|
67
|
+
)
|
68
|
+
out, err, status = Open3.capture3(capcmd(%w[murano config --project --unset doThisTest.bob]))
|
57
69
|
expect(status).to eq(0)
|
58
70
|
expect(out).to eq('')
|
59
71
|
expect(err).to eq('')
|
@@ -62,7 +74,6 @@ RSpec.describe 'murano config', :cmd do
|
|
62
74
|
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_deleted_bob').read
|
63
75
|
expect(afile).to eq(bfile)
|
64
76
|
end
|
65
|
-
|
66
77
|
end
|
67
78
|
|
68
79
|
# vim: set ai et sw=2 ts=2 :
|
data/spec/cmd_content_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 'fileutils'
|
2
9
|
require 'open3'
|
3
10
|
require 'pathname'
|
@@ -5,93 +12,98 @@ require 'yaml'
|
|
5
12
|
require 'cmd_common'
|
6
13
|
|
7
14
|
RSpec.describe 'murano content', :cmd, :needs_password do
|
8
|
-
include_context
|
15
|
+
include_context 'CI_CMD'
|
9
16
|
|
10
17
|
before(:example) do
|
11
18
|
@product_name = rname('contestTest')
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @product_name, '--save'))
|
20
|
+
expect(err).to eq('')
|
21
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
22
|
+
expect(status.exitstatus).to eq(0)
|
16
23
|
end
|
17
24
|
after(:example) do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
25
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', '--yes', @product_name))
|
26
|
+
expect(out).to eq('')
|
27
|
+
expect(err).to eq('')
|
28
|
+
expect(status.exitstatus).to eq(0)
|
22
29
|
end
|
23
30
|
|
24
|
-
it
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
it 'life cycle' do
|
32
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'list'))
|
33
|
+
#expect(out.lines).to match(
|
34
|
+
# [
|
35
|
+
# a_string_matching(/^(\+-+){2}\+$/),
|
36
|
+
# a_string_matching(/^\| Name\s+\| Size\s+\|$/),
|
37
|
+
# a_string_matching(/^(\+-+){2}\+$/),
|
38
|
+
# a_string_matching(/^(\+-+){2}\+$/),
|
39
|
+
# ]
|
40
|
+
#)
|
41
|
+
#expect(err).to eq('')
|
42
|
+
expect(out.lines).to match([])
|
43
|
+
expect(err).to eq("\e[33mDid not find any content\e[0m\n")
|
44
|
+
expect(status.exitstatus).to eq(0)
|
36
45
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
46
|
+
FileUtils.copy(File.join(@testdir, 'spec/fixtures/dumped_config'), 'myFile')
|
47
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'upload', 'myFile', '--tags', 'random=junk'))
|
48
|
+
expect(out).to eq('')
|
49
|
+
expect(err).to eq('')
|
50
|
+
expect(status.exitstatus).to eq(0)
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'list'))
|
53
|
+
expect(err).to eq('')
|
54
|
+
expect(out.lines).to match(
|
55
|
+
[
|
46
56
|
a_string_matching(/^(\+-+){2}\+$/),
|
47
57
|
a_string_matching(/^\| Name\s+\| Size\s+\|$/),
|
48
58
|
a_string_matching(/^(\+-+){2}\+$/),
|
49
59
|
a_string_matching(/^\| myFile\s+\| \d+\s+\|$/),
|
50
60
|
a_string_matching(/^(\+-+){2}\+$/),
|
51
|
-
]
|
52
|
-
|
61
|
+
]
|
62
|
+
)
|
63
|
+
expect(status.exitstatus).to eq(0)
|
53
64
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'info', 'myFile'))
|
66
|
+
expect(err).to eq('')
|
67
|
+
expect { out = YAML.load(out) }.to_not raise_error
|
68
|
+
expect(out).to match(
|
69
|
+
'type' => a_kind_of(String),
|
70
|
+
'length' => a_kind_of(Integer),
|
71
|
+
'last_modified' => a_kind_of(String),
|
72
|
+
'id' => 'myFile',
|
73
|
+
'tags' => {
|
74
|
+
'random' => 'junk',
|
75
|
+
}
|
76
|
+
)
|
77
|
+
expect(status.exitstatus).to eq(0)
|
67
78
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
79
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'download', 'myFile', '-o', 'testDown'))
|
80
|
+
expect(out).to eq('')
|
81
|
+
expect(err).to eq('')
|
82
|
+
expect(status.exitstatus).to eq(0)
|
83
|
+
expect(File.exist?('testDown')).to be true
|
84
|
+
dcf = IO.read('myFile')
|
85
|
+
tdf = IO.read('testDown')
|
86
|
+
expect(tdf).to eq(dcf)
|
76
87
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
88
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'delete', 'myFile', '-y'))
|
89
|
+
expect(out).to eq('')
|
90
|
+
expect(err).to eq('')
|
91
|
+
expect(status.exitstatus).to eq(0)
|
81
92
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'list'))
|
94
|
+
#expect(out.lines).to match(
|
95
|
+
# [
|
96
|
+
# a_string_matching(/^(\+-+){2}\+$/),
|
97
|
+
# a_string_matching(/^\| Name\s+\| Size\s+\|$/),
|
98
|
+
# a_string_matching(/^(\+-+){2}\+$/),
|
99
|
+
# a_string_matching(/^(\+-+){2}\+$/),
|
100
|
+
# ]
|
101
|
+
#)
|
102
|
+
#expect(err).to eq('')
|
103
|
+
expect(out.lines).to match([])
|
104
|
+
expect(err).to eq("\e[33mDid not find any content\e[0m\n")
|
105
|
+
expect(status.exitstatus).to eq(0)
|
93
106
|
end
|
94
|
-
|
95
107
|
end
|
96
108
|
|
97
109
|
# vim: set ai et sw=2 ts=2 :
|
data/spec/cmd_cors_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 'fileutils'
|
2
9
|
require 'open3'
|
3
10
|
require 'pathname'
|
@@ -5,7 +12,7 @@ require 'json'
|
|
5
12
|
require 'cmd_common'
|
6
13
|
|
7
14
|
RSpec.describe 'murano cors', :cmd, :needs_password do
|
8
|
-
include_context
|
15
|
+
include_context 'CI_CMD'
|
9
16
|
|
10
17
|
before(:example) do
|
11
18
|
@product_name = rname('corstest')
|
@@ -21,16 +28,16 @@ RSpec.describe 'murano cors', :cmd, :needs_password do
|
|
21
28
|
expect(status.exitstatus).to eq(0)
|
22
29
|
end
|
23
30
|
|
24
|
-
it
|
31
|
+
it 'show CORS' do
|
25
32
|
out, err, status = Open3.capture3(capcmd('murano', 'cors', '-c', 'outformat=json'))
|
26
33
|
expect { JSON.parse(out) }.to_not raise_error
|
27
34
|
expect(err).to eq('')
|
28
35
|
expect(status.exitstatus).to eq(0)
|
29
36
|
end
|
30
37
|
|
31
|
-
it
|
38
|
+
it 'sets CORS' do
|
32
39
|
File.open('cors.yaml', 'wb') do |io|
|
33
|
-
io << {:
|
40
|
+
io << { origin: ['http://localhost:*'] }.to_json
|
34
41
|
end
|
35
42
|
|
36
43
|
out, err, status = Open3.capture3(capcmd('murano', 'cors', 'set', 'cors.yaml'))
|
@@ -44,7 +51,6 @@ RSpec.describe 'murano cors', :cmd, :needs_password do
|
|
44
51
|
expect(err).to eq('')
|
45
52
|
expect(status.exitstatus).to eq(0)
|
46
53
|
end
|
47
|
-
|
48
54
|
end
|
49
55
|
|
50
56
|
# vim: set ai et sw=2 ts=2 :
|