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/Http_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 'MrMurano/version'
|
2
9
|
require 'MrMurano/http'
|
3
10
|
require 'MrMurano/verbosing'
|
@@ -14,7 +21,7 @@ class Tst
|
|
14
21
|
end
|
15
22
|
|
16
23
|
RSpec.describe MrMurano::Http do
|
17
|
-
include_context
|
24
|
+
include_context 'WORKSPACE'
|
18
25
|
|
19
26
|
before(:example) do
|
20
27
|
$cfg = MrMurano::Config.new
|
@@ -22,133 +29,137 @@ RSpec.describe MrMurano::Http do
|
|
22
29
|
@tst = Tst.new
|
23
30
|
end
|
24
31
|
|
25
|
-
context
|
32
|
+
context 'gets a token' do
|
26
33
|
before(:example) do
|
27
|
-
@acc = instance_double(
|
34
|
+
@acc = instance_double('MrMurano::Account')
|
28
35
|
#allow(MrMurano::Account).to receive(:new).and_return(@acc)
|
29
36
|
allow(MrMurano::Account).to receive(:instance).and_return(@acc)
|
30
37
|
end
|
31
38
|
|
32
|
-
it
|
33
|
-
@tst.instance_variable_set(:@token,
|
39
|
+
it 'already has one' do
|
40
|
+
@tst.instance_variable_set(:@token, 'ABCDEFG')
|
34
41
|
ret = @tst.token
|
35
|
-
expect(ret).to eq(
|
42
|
+
expect(ret).to eq('ABCDEFG')
|
36
43
|
end
|
37
44
|
|
38
|
-
it
|
45
|
+
it 'gets one' do
|
39
46
|
#expect(@acc).to receive(:adc_compat_check)
|
40
|
-
expect(@acc).to receive(:token).and_return(
|
47
|
+
expect(@acc).to receive(:token).and_return('ABCDEFG')
|
41
48
|
ret = @tst.token
|
42
|
-
expect(ret).to eq(
|
49
|
+
expect(ret).to eq('ABCDEFG')
|
43
50
|
end
|
44
51
|
|
45
|
-
it
|
52
|
+
it 'raises when not logged in' do
|
46
53
|
expect(@acc).to receive(:token).and_return(nil)
|
47
54
|
# 2017-07-13: The token command used to raise an error, but [lb]
|
48
55
|
# doesn't like seeing the "use --trace" message that Ruby spits
|
49
56
|
# out. So write to stderr and exit instead. Here, use check that
|
50
57
|
# the function exits by expecting it to raise SystemExit.
|
51
|
-
expect
|
58
|
+
expect do
|
52
59
|
@tst.token
|
53
|
-
|
60
|
+
end.to raise_error(SystemExit).and output("\e[31mNot logged in!\e[0m\n").to_stderr
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
57
|
-
context
|
64
|
+
context 'puts curl request' do
|
58
65
|
before(:example) do
|
59
|
-
@req = Net::HTTP::Get.new URI(
|
66
|
+
@req = Net::HTTP::Get.new URI('https://test.host/this/is/a/test')
|
60
67
|
@req.content_type = 'application/json'
|
61
68
|
@req['User-Agent'] = 'test'
|
62
69
|
end
|
63
|
-
it
|
70
|
+
it 'puts nothing' do
|
64
71
|
$cfg['tool.curldebug'] = false
|
65
72
|
$stdout = StringIO.new
|
66
73
|
@tst.curldebug(@req)
|
67
|
-
expect($stdout.string).to eq(
|
74
|
+
expect($stdout.string).to eq('')
|
68
75
|
end
|
69
76
|
|
70
|
-
it
|
77
|
+
it 'puts something' do
|
71
78
|
$cfg['tool.curldebug'] = true
|
72
79
|
$cfg.curlfile_f = nil
|
73
80
|
$stdout = StringIO.new
|
74
81
|
@tst.curldebug(@req)
|
75
|
-
expect($stdout.string).to eq(
|
82
|
+
expect($stdout.string).to eq(
|
83
|
+
%(curl -s -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test'\n)
|
84
|
+
)
|
76
85
|
end
|
77
86
|
|
78
|
-
it
|
87
|
+
it 'puts something with Auth' do
|
79
88
|
$cfg['tool.curldebug'] = true
|
80
89
|
$cfg.curlfile_f = nil
|
81
90
|
$stdout = StringIO.new
|
82
91
|
@req['Authorization'] = 'LetMeIn'
|
83
92
|
@tst.curldebug(@req)
|
84
|
-
expect($stdout.string).to eq(
|
93
|
+
expect($stdout.string).to eq(
|
94
|
+
%(curl -s -H 'Authorization: LetMeIn' -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test'\n)
|
95
|
+
)
|
85
96
|
end
|
86
97
|
|
87
|
-
it
|
98
|
+
it 'puts something with Body' do
|
88
99
|
$cfg['tool.curldebug'] = true
|
89
100
|
$cfg.curlfile_f = nil
|
90
101
|
$stdout = StringIO.new
|
91
|
-
@req.body =
|
102
|
+
@req.body = 'builder'
|
92
103
|
@tst.curldebug(@req)
|
93
|
-
expect($stdout.string).to eq(
|
104
|
+
expect($stdout.string).to eq(
|
105
|
+
%(curl -s -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test' -d 'builder'\n)
|
106
|
+
)
|
94
107
|
end
|
95
108
|
end
|
96
109
|
|
97
|
-
context
|
98
|
-
it
|
99
|
-
ok, data = @tst.isJSON(%{
|
110
|
+
context 'checks if JSON' do
|
111
|
+
it 'is JSON' do
|
112
|
+
ok, data = @tst.isJSON(%({"one": "two", "three":[1,2,3,4,5,6]}))
|
100
113
|
expect(ok).to be true
|
101
|
-
expect(data).to eq(
|
102
|
-
|
103
|
-
:three=>[1,2,3,4,5,6]
|
104
|
-
})
|
114
|
+
expect(data).to eq(one: 'two',
|
115
|
+
three: [1, 2, 3, 4, 5, 6])
|
105
116
|
end
|
106
|
-
it
|
107
|
-
ok, data = @tst.isJSON(%
|
117
|
+
it 'is not JSON' do
|
118
|
+
ok, data = @tst.isJSON(%(woeiutepoxam))
|
108
119
|
expect(ok).to be false
|
109
120
|
expect(data).to eq('woeiutepoxam')
|
110
121
|
end
|
111
122
|
end
|
112
123
|
|
113
|
-
context
|
124
|
+
context 'shows HTTP errors' do
|
114
125
|
before(:example) do
|
115
|
-
@req = Net::HTTP::Get.new URI(
|
126
|
+
@req = Net::HTTP::Get.new URI('https://test.host/this/is/a/test')
|
116
127
|
@req.content_type = 'application/json'
|
117
128
|
@req['User-Agent'] = 'test'
|
118
129
|
@rsp = Net::HTTPGone.new('1.1', 410, 'ok')
|
119
130
|
end
|
120
131
|
|
121
|
-
it
|
132
|
+
it 'shows debug details' do
|
122
133
|
$cfg['tool.debug'] = true
|
123
134
|
$stdout = StringIO.new
|
124
135
|
$stderr = StringIO.new
|
125
136
|
|
126
|
-
allow(@rsp).to receive(:body).and_return(
|
137
|
+
allow(@rsp).to receive(:body).and_return('ok')
|
127
138
|
expect(@tst).to receive(:error).once.with('Request Failed: 410: ok')
|
128
139
|
|
129
140
|
@tst.showHttpError(@req, @rsp)
|
130
|
-
expect($stdout.string).to eq(%
|
141
|
+
expect($stdout.string).to eq(%(Sent GET https://test.host/this/is/a/test
|
131
142
|
> Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
132
143
|
> Accept: */*
|
133
144
|
> User-Agent: test
|
134
145
|
> Host: test.host
|
135
146
|
> Content-Type: application/json
|
136
147
|
Got 410 ok
|
137
|
-
|
148
|
+
).gsub(/^\s+/, ''))
|
138
149
|
expect($stderr.string).to eq('')
|
139
150
|
end
|
140
151
|
|
141
|
-
it
|
152
|
+
it 'shows debug details; has req body' do
|
142
153
|
$cfg['tool.debug'] = true
|
143
154
|
$stdout = StringIO.new
|
144
155
|
$stderr = StringIO.new
|
145
156
|
|
146
|
-
allow(@req).to receive(:body).and_return(
|
147
|
-
allow(@rsp).to receive(:body).and_return(
|
157
|
+
allow(@req).to receive(:body).and_return('this is my body')
|
158
|
+
allow(@rsp).to receive(:body).and_return('ok')
|
148
159
|
expect(@tst).to receive(:error).once.with('Request Failed: 410: ok')
|
149
160
|
|
150
161
|
@tst.showHttpError(@req, @rsp)
|
151
|
-
expect($stdout.string).to eq(%
|
162
|
+
expect($stdout.string).to eq(%(Sent GET https://test.host/this/is/a/test
|
152
163
|
> Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
153
164
|
> Accept: */*
|
154
165
|
> User-Agent: test
|
@@ -156,59 +167,58 @@ RSpec.describe MrMurano::Http do
|
|
156
167
|
> Content-Type: application/json
|
157
168
|
>> this is my body
|
158
169
|
Got 410 ok
|
159
|
-
|
170
|
+
).gsub(/^\s+/, ''))
|
160
171
|
expect($stderr.string).to eq('')
|
161
172
|
end
|
162
173
|
|
163
|
-
it
|
174
|
+
it 'shows debug details; json body' do
|
164
175
|
$cfg['tool.debug'] = true
|
165
176
|
$stdout = StringIO.new
|
166
177
|
$stderr = StringIO.new
|
167
178
|
|
168
|
-
allow(@rsp).to receive(:body).and_return(%{
|
179
|
+
allow(@rsp).to receive(:body).and_return(%({"statusCode": 123, "message": "ok"}))
|
169
180
|
expect(@tst).to receive(:error).once.with('Request Failed: 410: [123] ok')
|
170
181
|
|
171
182
|
@tst.showHttpError(@req, @rsp)
|
172
|
-
expect($stdout.string).to eq(%
|
183
|
+
expect($stdout.string).to eq(%(Sent GET https://test.host/this/is/a/test
|
173
184
|
> Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
174
185
|
> Accept: */*
|
175
186
|
> User-Agent: test
|
176
187
|
> Host: test.host
|
177
188
|
> Content-Type: application/json
|
178
189
|
Got 410 ok
|
179
|
-
|
190
|
+
).gsub(/^\s+/, ''))
|
180
191
|
expect($stderr.string).to eq('')
|
181
192
|
end
|
182
193
|
|
183
|
-
it
|
194
|
+
it 'shows full error responses' do
|
184
195
|
$cfg['tool.fullerror'] = true
|
185
196
|
$stdout = StringIO.new
|
186
197
|
$stderr = StringIO.new
|
187
198
|
|
188
|
-
allow(@rsp).to receive(:body).and_return(%{
|
189
|
-
expect(@tst).to receive(:error).once.with(
|
199
|
+
allow(@rsp).to receive(:body).and_return(%({"statusCode": 123, "message": "ok"}))
|
200
|
+
expect(@tst).to receive(:error).once.with(
|
201
|
+
"Request Failed: 410: {\n \"statusCode\": 123,\n \"message\": \"ok\"\n}"
|
202
|
+
)
|
190
203
|
|
191
204
|
@tst.showHttpError(@req, @rsp)
|
192
205
|
expect($stdout.string).to eq('')
|
193
206
|
expect($stderr.string).to eq('')
|
194
207
|
end
|
195
208
|
|
196
|
-
|
197
|
-
it "calls showHttpError" do
|
209
|
+
it 'calls showHttpError' do
|
198
210
|
$stdout = StringIO.new
|
199
211
|
$stderr = StringIO.new
|
200
212
|
|
201
213
|
idhttp = instance_double('Net::HTTP')
|
202
214
|
expect(idhttp).to receive(:request).once.and_return(@rsp)
|
203
215
|
expect(@tst).to receive(:http).once.and_return(idhttp)
|
204
|
-
expect(@rsp).to receive(:body).and_return(%{
|
216
|
+
expect(@rsp).to receive(:body).and_return(%({"statusCode": 123, "message": "gone"}))
|
205
217
|
|
206
218
|
@tst.workit(@req)
|
207
219
|
expect($stdout.string).to eq('')
|
208
220
|
expect($stderr.string).to eq("\e[31mRequest Failed: 410: [123] gone\e[0m\n")
|
209
|
-
|
210
221
|
end
|
211
222
|
end
|
212
|
-
|
213
223
|
end
|
214
|
-
|
224
|
+
|
data/spec/MakePretties_spec.rb
CHANGED
@@ -1,118 +1,127 @@
|
|
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 'MrMurano/version'
|
2
9
|
require 'MrMurano/makePretty'
|
3
10
|
|
4
11
|
RSpec.describe MrMurano::Pretties do
|
5
12
|
before(:example) do
|
6
|
-
@options = {:
|
13
|
+
@options = { pretty: true, localtime: false }
|
14
|
+
# [lb] not sure how to fix this warning...
|
15
|
+
# rubocop:disable Style/MethodMissing
|
16
|
+
# "When using method_missing, define respond_to_missing?"
|
7
17
|
def @options.method_missing(mid)
|
8
18
|
self[mid]
|
9
19
|
end
|
10
20
|
end
|
11
21
|
|
12
|
-
it
|
13
|
-
data ={:
|
14
|
-
|
15
|
-
|
16
|
-
str ="\e[35m{\e[0m\n \"type\": \"debug\",\n \"timestamp\": 1476386031,\n \"subject\": \"websocket_websocket_info\",\n \"data\": \"Script Error: \"\n\e[35m}\e[0m"
|
17
|
-
ret = MrMurano::Pretties
|
22
|
+
it 'makes json pretty with color' do
|
23
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
24
|
+
subject: 'websocket_websocket_info',
|
25
|
+
data: 'Script Error: ', }
|
26
|
+
str = "\e[35m{\e[0m\n \"type\": \"debug\",\n \"timestamp\": 1476386031,\n \"subject\": \"websocket_websocket_info\",\n \"data\": \"Script Error: \"\n\e[35m}\e[0m"
|
27
|
+
ret = MrMurano::Pretties.makeJsonPretty(data, @options)
|
18
28
|
expect(ret).to eq(str)
|
19
29
|
end
|
20
|
-
it
|
21
|
-
data ={:
|
22
|
-
|
23
|
-
|
24
|
-
str =
|
30
|
+
it 'makes json pretty without color' do
|
31
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
32
|
+
subject: 'websocket_websocket_info',
|
33
|
+
data: 'Script Error: ', }
|
34
|
+
str = '{"type":"debug","timestamp":1476386031,"subject":"websocket_websocket_info","data":"Script Error: "}'
|
25
35
|
@options[:pretty] = false
|
26
|
-
ret = MrMurano::Pretties
|
36
|
+
ret = MrMurano::Pretties.makeJsonPretty(data, @options)
|
27
37
|
expect(ret).to eq(str)
|
28
38
|
end
|
29
39
|
|
30
|
-
it
|
31
|
-
data ={:
|
32
|
-
|
33
|
-
|
34
|
-
str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
|
35
|
-
ret = MrMurano::Pretties
|
40
|
+
it 'makes it pretty.' do
|
41
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
42
|
+
subject: 'websocket_websocket_info',
|
43
|
+
data: 'Script Error: ', }
|
44
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
|
45
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
36
46
|
expect(ret).to eq(str)
|
37
47
|
end
|
38
48
|
|
39
|
-
it
|
40
|
-
data ={:
|
41
|
-
|
42
|
-
|
43
|
-
str ="\e[31m\e[48;5;231m-- \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
|
44
|
-
ret = MrMurano::Pretties
|
49
|
+
it 'makes it pretty; missing type' do
|
50
|
+
data = { timestamp: 1_476_386_031,
|
51
|
+
subject: 'websocket_websocket_info',
|
52
|
+
data: 'Script Error: ', }
|
53
|
+
str = "\e[31m\e[48;5;231m-- \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
|
54
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
45
55
|
expect(ret).to eq(str)
|
46
56
|
end
|
47
57
|
|
48
|
-
it
|
49
|
-
data ={:
|
50
|
-
|
51
|
-
|
52
|
-
ldt = Time.at(
|
53
|
-
str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m#{ldt}\e[0m:\nScript Error: "
|
58
|
+
it 'makes it pretty; localtime' do
|
59
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
60
|
+
subject: 'websocket_websocket_info',
|
61
|
+
data: 'Script Error: ', }
|
62
|
+
ldt = Time.at(1_476_386_031).localtime.to_datetime.iso8601(3)
|
63
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m#{ldt}\e[0m:\nScript Error: "
|
54
64
|
@options[:localtime] = true
|
55
|
-
ret = MrMurano::Pretties
|
65
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
56
66
|
@options[:localtime] = false
|
57
67
|
expect(ret).to eq(str)
|
58
68
|
end
|
59
69
|
|
60
|
-
it
|
61
|
-
data ={:
|
62
|
-
|
63
|
-
|
64
|
-
str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m<no timestamp>\e[0m:\nScript Error: "
|
65
|
-
ret = MrMurano::Pretties
|
70
|
+
it 'makes it pretty; missing timestamp' do
|
71
|
+
data = { type: 'debug',
|
72
|
+
subject: 'websocket_websocket_info',
|
73
|
+
data: 'Script Error: ', }
|
74
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m<no timestamp>\e[0m:\nScript Error: "
|
75
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
66
76
|
expect(ret).to eq(str)
|
67
77
|
end
|
68
78
|
|
69
|
-
it
|
70
|
-
data ={:
|
71
|
-
|
72
|
-
str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
|
73
|
-
ret = MrMurano::Pretties
|
79
|
+
it 'makes it pretty; missing subject' do
|
80
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
81
|
+
data: 'Script Error: ', }
|
82
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
|
83
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
74
84
|
expect(ret).to eq(str)
|
75
85
|
end
|
76
86
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
ret = MrMurano::Pretties::makePretty(data, @options)
|
87
|
+
it 'makes it pretty; missing data' do
|
88
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
89
|
+
subject: 'websocket_websocket_info', }
|
90
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n\e[35m}\e[0m"
|
91
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
83
92
|
expect(ret).to eq(str)
|
84
93
|
end
|
85
94
|
|
86
|
-
it
|
87
|
-
data ={:
|
88
|
-
|
89
|
-
|
90
|
-
str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34mbob\e[0m:\nScript Error: "
|
91
|
-
ret = MrMurano::Pretties
|
95
|
+
it 'makes it pretty; NAN timestamp' do
|
96
|
+
data = { type: 'debug', timestamp: 'bob',
|
97
|
+
subject: 'websocket_websocket_info',
|
98
|
+
data: 'Script Error: ', }
|
99
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34mbob\e[0m:\nScript Error: "
|
100
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
92
101
|
expect(ret).to eq(str)
|
93
102
|
end
|
94
103
|
|
95
|
-
it
|
96
|
-
data ={:
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n \"random\": \"junk\"\n\e[35m}\e[0m"
|
102
|
-
ret = MrMurano::Pretties
|
104
|
+
it 'makes it pretty; hash data' do
|
105
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
106
|
+
subject: 'websocket_websocket_info',
|
107
|
+
data: {
|
108
|
+
random: 'junk',
|
109
|
+
}, }
|
110
|
+
str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n \"random\": \"junk\"\n\e[35m}\e[0m"
|
111
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
103
112
|
expect(ret).to eq(str)
|
104
113
|
end
|
105
114
|
|
106
|
-
it
|
107
|
-
data ={:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
str
|
114
|
-
ret = MrMurano::Pretties
|
115
|
+
it 'makes it pretty; http hash data' do
|
116
|
+
data = { type: 'debug', timestamp: 1_476_386_031,
|
117
|
+
subject: 'websocket_websocket_info',
|
118
|
+
data: {
|
119
|
+
request: { method: 'get' },
|
120
|
+
response: { status: 200 },
|
121
|
+
}, }
|
122
|
+
str = %(\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n---------\nrequest:\e[35m{\e[0m\n "method\": \"get\"\n\e[35m}\e[0m\n---------\nresponse:\e[35m{\e[0m\n \"status\": 200\n\e[35m}\e[0m)
|
123
|
+
ret = MrMurano::Pretties.makePretty(data, @options)
|
115
124
|
expect(ret).to eq(str)
|
116
125
|
end
|
117
126
|
end
|
118
|
-
|
127
|
+
|