MuranoCLI 3.2.1.pre.beta.6 → 3.2.1.pre.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +10 -0
- data/MuranoCLI.gemspec +37 -6
- data/Rakefile +38 -11
- data/lib/MrMurano/commands/business.rb +0 -4
- data/lib/MrMurano/version.rb +1 -1
- metadata +2 -251
- data/dockers/Dockerfile.2.2.9 +0 -40
- data/dockers/Dockerfile.2.3.6 +0 -40
- data/dockers/Dockerfile.2.4.3 +0 -40
- data/dockers/Dockerfile.2.5.0 +0 -40
- data/dockers/Dockerfile.GemRelease +0 -49
- data/dockers/Dockerfile.m4 +0 -122
- data/dockers/README.rst +0 -362
- data/dockers/RELEASE.rst +0 -135
- data/dockers/docker-test.sh +0 -163
- data/dockers/gem-release.sh +0 -4
- data/docs/basic_example.rst +0 -436
- data/docs/ci/.trustme.plugin +0 -140
- data/docs/ci/.trustme.sh +0 -516
- data/docs/ci/.trustme.vim +0 -55
- data/docs/completions/murano_completion-bash +0 -4484
- data/docs/demo.md +0 -109
- data/docs/develop.rst +0 -392
- data/docs/release.rst +0 -295
- data/spec/Account-Passwords_spec.rb +0 -245
- data/spec/Account_spec.rb +0 -256
- data/spec/Business_spec.rb +0 -307
- data/spec/ConfigFile_spec.rb +0 -55
- data/spec/ConfigMigrate_spec.rb +0 -108
- data/spec/Config_spec.rb +0 -440
- data/spec/Content_spec.rb +0 -422
- data/spec/GatewayBase_spec.rb +0 -65
- data/spec/GatewayDevice_spec.rb +0 -403
- data/spec/GatewayResource_spec.rb +0 -283
- data/spec/GatewaySettings_spec.rb +0 -130
- data/spec/HttpAuthed_spec.rb +0 -87
- data/spec/Http_spec.rb +0 -220
- data/spec/MakePretties_spec.rb +0 -127
- data/spec/Mock_spec.rb +0 -62
- data/spec/ProjectFile_spec.rb +0 -381
- data/spec/Setting_spec.rb +0 -120
- data/spec/Solution-ServiceConfig_spec.rb +0 -272
- data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
- data/spec/Solution-ServiceModules_spec.rb +0 -562
- data/spec/Solution-UsersRoles_spec.rb +0 -269
- data/spec/Solution_spec.rb +0 -140
- data/spec/SyncRoot_spec.rb +0 -111
- data/spec/SyncUpDown_spec.rb +0 -868
- data/spec/Verbosing_spec.rb +0 -332
- data/spec/Webservice-Cors_spec.rb +0 -225
- data/spec/Webservice-Endpoint_spec.rb +0 -650
- data/spec/Webservice-File_spec.rb +0 -282
- data/spec/Webservice-Setting_spec.rb +0 -105
- data/spec/_workspace.rb +0 -43
- data/spec/cmd_business_spec.rb +0 -64
- data/spec/cmd_common.rb +0 -507
- data/spec/cmd_config_spec.rb +0 -73
- data/spec/cmd_content_spec.rb +0 -109
- data/spec/cmd_cors_spec.rb +0 -54
- data/spec/cmd_device_spec.rb +0 -130
- data/spec/cmd_domain_spec.rb +0 -62
- data/spec/cmd_element_spec.rb +0 -401
- data/spec/cmd_exchange_spec.rb +0 -114
- data/spec/cmd_help_spec.rb +0 -72
- data/spec/cmd_init_spec.rb +0 -475
- data/spec/cmd_keystore_spec.rb +0 -97
- data/spec/cmd_link_spec.rb +0 -105
- data/spec/cmd_logs_spec.rb +0 -162
- data/spec/cmd_password_spec.rb +0 -64
- data/spec/cmd_setting_application_spec.rb +0 -300
- data/spec/cmd_setting_product_spec.rb +0 -246
- data/spec/cmd_status_spec.rb +0 -300
- data/spec/cmd_syncdown_application_spec.rb +0 -128
- data/spec/cmd_syncdown_both_spec.rb +0 -178
- data/spec/cmd_syncdown_unit_spec.rb +0 -861
- data/spec/cmd_syncup_spec.rb +0 -148
- data/spec/cmd_token_spec.rb +0 -53
- data/spec/cmd_usage_spec.rb +0 -79
- data/spec/dry_run_formatter.rb +0 -28
- data/spec/fixtures/.mrmuranorc +0 -9
- data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
- data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
- data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
- data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
- data/spec/fixtures/SolutionFiles/0.2.json +0 -21
- data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
- data/spec/fixtures/SolutionFiles/0.3.json +0 -20
- data/spec/fixtures/SolutionFiles/basic.json +0 -20
- data/spec/fixtures/SolutionFiles/secret.json +0 -6
- data/spec/fixtures/configfile +0 -9
- data/spec/fixtures/dumped_config +0 -57
- data/spec/fixtures/exchange_element/element-show.json +0 -1
- data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
- data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
- data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
- data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
- data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
- data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
- data/spec/fixtures/mrmuranorc_tool_bob +0 -3
- data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
- data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
- data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
- data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
- data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
- data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
- data/spec/fixtures/roles-three.yaml +0 -11
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
- data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
- data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
- data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
- data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
- data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
- data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
- data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
- data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
- data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
- data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
- data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
- data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
- data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
- data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
- data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
- data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
- data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
- data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
- data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
- data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
- data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
- data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
- data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
- data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
- data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
- data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
- data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
- data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
- data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
- data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
- data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
- data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
- data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
- data/spec/fixtures/syncable_content/assets/icon.png +0 -0
- data/spec/fixtures/syncable_content/assets/index.html +0 -0
- data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
- data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
- data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
- data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
- data/spec/fixtures/websocket/README.rst +0 -110
- data/spec/fixtures/websocket/logs_blather.rb +0 -27
- data/spec/fixtures/websocket/logs_faker.rb +0 -153
- data/spec/fixtures/websocket/simple_connection.rb +0 -45
- data/spec/fixtures/websocket/simple_options.rb +0 -77
- data/spec/fixtures/websocket/simple_server.rb +0 -69
- data/spec/fixtures/websocket/wss-echo.rb +0 -48
- data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
- data/spec/spec_helper.rb +0 -131
- data/spec/variegated_TruthyFalsey_spec.rb +0 -29
- data/spec/webmock_snapshot.rb +0 -296
@@ -1,269 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'pathname'
|
9
|
-
require 'tempfile'
|
10
|
-
require 'webmock'
|
11
|
-
|
12
|
-
require 'MrMurano/hash'
|
13
|
-
require 'MrMurano/version'
|
14
|
-
require 'MrMurano/HttpAuthed'
|
15
|
-
require 'MrMurano/Solution-Users'
|
16
|
-
require 'MrMurano/SyncRoot'
|
17
|
-
require '_workspace'
|
18
|
-
require 'HttpAuthed_spec'
|
19
|
-
|
20
|
-
RSpec.describe MrMurano::Role do
|
21
|
-
include_context 'WORKSPACE'
|
22
|
-
|
23
|
-
before(:example) do
|
24
|
-
$cfg = MrMurano::Config.new
|
25
|
-
$cfg.load
|
26
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
27
|
-
$cfg['application.id'] = 'XYZ'
|
28
|
-
stub_request_email_password
|
29
|
-
|
30
|
-
@srv = MrMurano::Role.new
|
31
|
-
MrMurano::HttpAuthed.instance.instance_variable_set(:@token_biz, 'TTTTTTTTTT')
|
32
|
-
end
|
33
|
-
|
34
|
-
after(:example) do
|
35
|
-
WebMock.reset!
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'initializes' do
|
39
|
-
uri = @srv.endpoint('/')
|
40
|
-
expect(uri.to_s).to eq(
|
41
|
-
'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'lists' do
|
46
|
-
body = [
|
47
|
-
{
|
48
|
-
role_id: 'guest', parameter: [{ name: 'did' }],
|
49
|
-
},
|
50
|
-
{ role_id: 'admin', parameter: [{ name: 'enabled' }] },
|
51
|
-
{ role_id: 'owns', parameter: [{ name: 'did' }] },
|
52
|
-
]
|
53
|
-
stub_request(
|
54
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role'
|
55
|
-
).with(
|
56
|
-
headers: {
|
57
|
-
'Authorization' => 'token TTTTTTTTTT',
|
58
|
-
'Content-Type' => 'application/json',
|
59
|
-
}
|
60
|
-
).to_return(body: body.to_json)
|
61
|
-
ret = @srv.list
|
62
|
-
expect(ret).to eq(body)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'fetches' do
|
66
|
-
body = { role_id: 'guest', parameter: [{ name: 'did' }] }
|
67
|
-
stub_request(
|
68
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
|
69
|
-
).with(
|
70
|
-
headers: {
|
71
|
-
'Authorization' => 'token TTTTTTTTTT',
|
72
|
-
'Content-Type' => 'application/json',
|
73
|
-
}
|
74
|
-
).to_return(body: body.to_json)
|
75
|
-
ret = @srv.fetch('guest')
|
76
|
-
expect(ret).to eq(body)
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'removes' do
|
80
|
-
stub_request(
|
81
|
-
:delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
|
82
|
-
).with(
|
83
|
-
headers: {
|
84
|
-
'Authorization' => 'token TTTTTTTTTT',
|
85
|
-
'Content-Type' => 'application/json',
|
86
|
-
}
|
87
|
-
).to_return(status: 200, body: '')
|
88
|
-
ret = @srv.remove('guest')
|
89
|
-
expect(ret).to eq({})
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'uploads' do
|
93
|
-
it 'updating' do
|
94
|
-
body = { role_id: 'guest', parameter: [{ name: 'did' }] }
|
95
|
-
stub_request(
|
96
|
-
:delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
|
97
|
-
).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
|
98
|
-
'Content-Type' => 'application/json', }).to_return(status: 200, body: '')
|
99
|
-
stub_request(
|
100
|
-
:post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
|
101
|
-
).with(
|
102
|
-
headers: {
|
103
|
-
'Authorization' => 'token TTTTTTTTTT',
|
104
|
-
'Content-Type' => 'application/json',
|
105
|
-
},
|
106
|
-
body: body.to_json
|
107
|
-
).to_return(status: 205, body: '')
|
108
|
-
|
109
|
-
@srv.upload(nil, body, true)
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'creating' do
|
113
|
-
body = { role_id: 'guest', parameter: [{ name: 'did' }] }
|
114
|
-
stub_request(
|
115
|
-
:delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
|
116
|
-
).with(
|
117
|
-
headers: {
|
118
|
-
'Authorization' => 'token TTTTTTTTTT',
|
119
|
-
'Content-Type' => 'application/json',
|
120
|
-
}
|
121
|
-
).to_return(status: 404, body: '')
|
122
|
-
stub_request(
|
123
|
-
:post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
|
124
|
-
).with(
|
125
|
-
headers: {
|
126
|
-
'Authorization' => 'token TTTTTTTTTT',
|
127
|
-
'Content-Type' => 'application/json',
|
128
|
-
},
|
129
|
-
body: body.to_json
|
130
|
-
).to_return(status: 205, body: '')
|
131
|
-
|
132
|
-
@srv.upload(nil, body, false)
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'with delete error' do
|
136
|
-
body = { role_id: 'guest', parameter: [{ name: 'did' }] }
|
137
|
-
stub_request(
|
138
|
-
:delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/guest'
|
139
|
-
).with(
|
140
|
-
headers: {
|
141
|
-
'Authorization' => 'token TTTTTTTTTT',
|
142
|
-
'Content-Type' => 'application/json',
|
143
|
-
}
|
144
|
-
).to_return(status: 418, body: "I'm a teapot!")
|
145
|
-
stub_request(
|
146
|
-
:post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/role/'
|
147
|
-
).with(
|
148
|
-
headers: {
|
149
|
-
'Authorization' => 'token TTTTTTTTTT',
|
150
|
-
'Content-Type' => 'application/json',
|
151
|
-
},
|
152
|
-
body: body.to_json
|
153
|
-
).to_return(status: 205, body: '')
|
154
|
-
|
155
|
-
saved = $stderr
|
156
|
-
$stderr = StringIO.new
|
157
|
-
@srv.upload(nil, body, false)
|
158
|
-
expect($stderr.string).to match(/Request Failed: 418: I'm a teapot/)
|
159
|
-
$stderr = saved
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
context 'downloads' do
|
164
|
-
before(:example) do
|
165
|
-
@lry = Pathname.new(@project_dir) + 'roles.yaml'
|
166
|
-
@grl = { role_id: 'guest', parameter: [{ name: 'could' }] }
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'creates' do
|
170
|
-
@srv.download(@lry, @grl)
|
171
|
-
|
172
|
-
expect(@lry.exist?).to be true
|
173
|
-
got = YAML.load(@lry.read)
|
174
|
-
expect(got).to include(Hash.transform_keys_to_strings(@grl))
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'updates' do
|
178
|
-
FileUtils.copy(File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path)
|
179
|
-
|
180
|
-
@srv.download(@lry, @grl)
|
181
|
-
got = YAML.load(@lry.read)
|
182
|
-
expect(got).to include(Hash.transform_keys_to_strings(@grl))
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
context 'removing local roles' do
|
187
|
-
before(:example) do
|
188
|
-
@lry = Pathname.new(@project_dir) + 'roles.yaml'
|
189
|
-
@grl = { role_id: 'guest', parameter: [{ name: 'could' }] }
|
190
|
-
end
|
191
|
-
|
192
|
-
it 'when file missing' do
|
193
|
-
@srv.removelocal(@lry, @grl)
|
194
|
-
expect(@lry.exist?).to be true
|
195
|
-
got = YAML.load(@lry.read)
|
196
|
-
expect(got).to eq([])
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'when not there' do
|
200
|
-
FileUtils.copy(
|
201
|
-
File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path
|
202
|
-
)
|
203
|
-
@srv.removelocal(@lry, role_id: 'undertow')
|
204
|
-
got = YAML.load(@lry.read)
|
205
|
-
rty = Pathname.new(@testdir) + 'spec/fixtures/roles-three.yaml'
|
206
|
-
want = YAML.load(rty.read)
|
207
|
-
expect(got).to eq(want)
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'with matching role' do
|
211
|
-
FileUtils.copy(
|
212
|
-
File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path
|
213
|
-
)
|
214
|
-
@srv.removelocal(@lry, @grl)
|
215
|
-
got = YAML.load(@lry.read)
|
216
|
-
expect(got.count).to eq(2)
|
217
|
-
expect(got).to contain_exactly(
|
218
|
-
a_hash_including('role_id' => 'admin'),
|
219
|
-
a_hash_including('role_id' => 'owns')
|
220
|
-
)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
it 'tolocalpath is into' do
|
225
|
-
lry = Pathname.new(@project_dir) + 'roles.yaml'
|
226
|
-
ret = @srv.tolocalpath(lry, role_id: 'guest', parameter: [{ name: 'could' }])
|
227
|
-
expect(ret).to eq(lry)
|
228
|
-
end
|
229
|
-
|
230
|
-
context 'list local items' do
|
231
|
-
before(:example) do
|
232
|
-
@lry = Pathname.new(@project_dir) + 'roles.yaml'
|
233
|
-
end
|
234
|
-
|
235
|
-
it 'when missing' do
|
236
|
-
expect(@srv).to receive(:warning).with(/^Skipping missing/)
|
237
|
-
ret = @srv.localitems(@lry)
|
238
|
-
expect(ret).to eq([])
|
239
|
-
end
|
240
|
-
|
241
|
-
it 'when not a file' do
|
242
|
-
FileUtils.mkpath(@lry.to_path)
|
243
|
-
expect(@srv).to receive(:warning).with(/^Cannot read from/)
|
244
|
-
ret = @srv.localitems(@lry)
|
245
|
-
expect(ret).to eq([])
|
246
|
-
end
|
247
|
-
|
248
|
-
it 'when empty' do
|
249
|
-
FileUtils.touch(@lry.to_path)
|
250
|
-
ret = @srv.localitems(@lry)
|
251
|
-
expect(ret).to eq([])
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'with roles' do
|
255
|
-
FileUtils.copy(
|
256
|
-
File.join(@testdir, 'spec/fixtures/roles-three.yaml'), @lry.to_path
|
257
|
-
)
|
258
|
-
ret = @srv.localitems(@lry)
|
259
|
-
expect(ret).to eq(
|
260
|
-
[
|
261
|
-
{ role_id: 'guest', parameter: [{ name: 'did' }] },
|
262
|
-
{ role_id: 'admin', parameter: [{ name: 'enabled' }] },
|
263
|
-
{ role_id: 'owns', parameter: [{ name: 'did' }] },
|
264
|
-
]
|
265
|
-
)
|
266
|
-
end
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
data/spec/Solution_spec.rb
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'tempfile'
|
9
|
-
require 'webmock'
|
10
|
-
require 'yaml'
|
11
|
-
|
12
|
-
require 'MrMurano/version'
|
13
|
-
require 'MrMurano/HttpAuthed'
|
14
|
-
require 'MrMurano/ProjectFile'
|
15
|
-
require 'MrMurano/Solution'
|
16
|
-
require 'MrMurano/SyncRoot'
|
17
|
-
require '_workspace'
|
18
|
-
require 'HttpAuthed_spec'
|
19
|
-
|
20
|
-
RSpec.describe MrMurano::Solution do
|
21
|
-
include_context 'WORKSPACE'
|
22
|
-
|
23
|
-
before(:example) do
|
24
|
-
$cfg = MrMurano::Config.new
|
25
|
-
$cfg.load
|
26
|
-
|
27
|
-
$project = MrMurano::ProjectFile.new
|
28
|
-
$project.load
|
29
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
30
|
-
$cfg['product.id'] = 'XYZ'
|
31
|
-
$cfg['application.id'] = 'XYZ'
|
32
|
-
|
33
|
-
stub_request_email_password
|
34
|
-
|
35
|
-
# NOTE: This test works on either Product or Application.
|
36
|
-
# MAYBE: Add Application to this test.
|
37
|
-
@srv = MrMurano::Product.new
|
38
|
-
#@srv = MrMurano::Application.new
|
39
|
-
|
40
|
-
MrMurano::HttpAuthed.instance.instance_variable_set(:@token_biz, 'TTTTTTTTTT')
|
41
|
-
end
|
42
|
-
|
43
|
-
after(:example) do
|
44
|
-
WebMock.reset!
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'initializes' do
|
48
|
-
uri = @srv.endpoint('/')
|
49
|
-
expect(uri.to_s).to eq(
|
50
|
-
'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/'
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'gets info' do
|
55
|
-
body = {
|
56
|
-
id: 'XYZ',
|
57
|
-
label: nil,
|
58
|
-
domain: 'ugdemo.apps.exosite.io',
|
59
|
-
biz_id: 'ABCDEFG',
|
60
|
-
cors: '{"origin":true,"methods":["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],"headers":["Content-Type","Cookie","Authorization"],"credentials":true}',
|
61
|
-
}
|
62
|
-
|
63
|
-
stub_request(
|
64
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ'
|
65
|
-
).with(
|
66
|
-
headers: {
|
67
|
-
'Authorization' => 'token TTTTTTTTTT',
|
68
|
-
'Content-Type' => 'application/json',
|
69
|
-
}
|
70
|
-
).to_return(body: body.to_json)
|
71
|
-
|
72
|
-
ret = @srv.info
|
73
|
-
expect(ret).to eq(body)
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'lists' do
|
77
|
-
body = {
|
78
|
-
id: 'XYZ',
|
79
|
-
label: nil,
|
80
|
-
domain: 'ugdemo.apps.exosite.io',
|
81
|
-
biz_id: 'ABCDEFG',
|
82
|
-
cors: '{"origin":true,"methods":["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],"headers":["Content-Type","Cookie","Authorization"],"credentials":true}',
|
83
|
-
}
|
84
|
-
|
85
|
-
stub_request(
|
86
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/'
|
87
|
-
).with(
|
88
|
-
headers: {
|
89
|
-
'Authorization' => 'token TTTTTTTTTT',
|
90
|
-
'Content-Type' => 'application/json',
|
91
|
-
}
|
92
|
-
).to_return(body: body.to_json)
|
93
|
-
|
94
|
-
ret = @srv.list
|
95
|
-
expect(ret).to eq(body)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'Gets version' do
|
99
|
-
body = { min_cli_version: '0.10' }
|
100
|
-
stub_request(
|
101
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/version'
|
102
|
-
).with(
|
103
|
-
headers: {
|
104
|
-
'Authorization' => 'token TTTTTTTTTT',
|
105
|
-
'Content-Type' => 'application/json',
|
106
|
-
}
|
107
|
-
).to_return(body: body.to_json)
|
108
|
-
|
109
|
-
ret = @srv.version
|
110
|
-
expect(ret).to eq(body)
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'Gets logs' do
|
114
|
-
body = {
|
115
|
-
p: [
|
116
|
-
{
|
117
|
-
type: 'error',
|
118
|
-
timestamp: 1_481_746_755,
|
119
|
-
subject: 'service call failed',
|
120
|
-
data: {
|
121
|
-
service_alias: 'user', function_call: 'assignUser',
|
122
|
-
},
|
123
|
-
},
|
124
|
-
],
|
125
|
-
total: 1,
|
126
|
-
}
|
127
|
-
stub_request(
|
128
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/logs'
|
129
|
-
).with(
|
130
|
-
headers: {
|
131
|
-
'Authorization' => 'token TTTTTTTTTT',
|
132
|
-
'Content-Type' => 'application/json',
|
133
|
-
}
|
134
|
-
).to_return(body: body.to_json)
|
135
|
-
|
136
|
-
ret = @srv.log
|
137
|
-
expect(ret).to eq(body)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
data/spec/SyncRoot_spec.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'MrMurano/version'
|
9
|
-
require 'MrMurano/Config'
|
10
|
-
require 'MrMurano/ProjectFile'
|
11
|
-
require 'MrMurano/SyncRoot'
|
12
|
-
require 'MrMurano/SyncUpDown'
|
13
|
-
require '_workspace'
|
14
|
-
|
15
|
-
RSpec.describe MrMurano::SyncRoot do
|
16
|
-
include_context 'WORKSPACE'
|
17
|
-
|
18
|
-
before(:example) do
|
19
|
-
@syncsetypes = MrMurano::SyncRoot.instance.reset # also creates @@syncset
|
20
|
-
# Weird/2017-07-31: I [lb] must[ve changed something, because this
|
21
|
-
# block being called twice, which is generating a warning:
|
22
|
-
# /exo/clients/exosite/MuranoCLIs/MuranoCLI+landonb/spec/SyncRoot_spec.rb:30:
|
23
|
-
# warning: method redefined; discarding old description
|
24
|
-
# /exo/clients/exosite/MuranoCLIs/MuranoCLI+landonb/spec/SyncRoot_spec.rb:30:
|
25
|
-
# warning: previous definition of description was here
|
26
|
-
unless defined?(User)
|
27
|
-
class User
|
28
|
-
def self.description
|
29
|
-
%(describe user)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
MrMurano::SyncRoot.instance.add('user', User, 'U', true)
|
34
|
-
unless defined?(Role)
|
35
|
-
class Role
|
36
|
-
def self.description
|
37
|
-
%(describe role)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
MrMurano::SyncRoot.instance.add('role', Role, 'G', false)
|
42
|
-
|
43
|
-
# This must happen after all syncables have been added.
|
44
|
-
$cfg = MrMurano::Config.new
|
45
|
-
$cfg.load
|
46
|
-
$project = MrMurano::ProjectFile.new
|
47
|
-
$project.load
|
48
|
-
|
49
|
-
@options = {}
|
50
|
-
@options.define_singleton_method(:method_missing) do |mid, *args|
|
51
|
-
if mid.to_s =~ /^(.+)=$/
|
52
|
-
self[Regexp.last_match(1).to_sym] = args.first
|
53
|
-
else
|
54
|
-
self[mid]
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
after(:example) do
|
60
|
-
MrMurano::SyncRoot.instance.reset(@syncsetypes)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'has defaults' do
|
64
|
-
ret = MrMurano::SyncRoot.instance.bydefault
|
65
|
-
expect(ret).to eq(['user'])
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'iterates on each' do
|
69
|
-
ret = []
|
70
|
-
MrMurano::SyncRoot.instance.each { |a, _b, _c, _d| ret << a }
|
71
|
-
expect(ret).to eq(%w[user role])
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'iterates only on selected' do
|
75
|
-
@options.role = true
|
76
|
-
ret = []
|
77
|
-
MrMurano::SyncRoot.instance.each_filtered(@options) { |a, _b, _c, _d| ret << a }
|
78
|
-
expect(ret).to eq(['role'])
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'selects all' do
|
82
|
-
@options.all = true
|
83
|
-
MrMurano::SyncRoot.instance.check_same(@options)
|
84
|
-
expect(@options).to eq(all: true, user: true, role: true)
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'selects defaults when none' do
|
88
|
-
MrMurano::SyncRoot.instance.check_same(@options)
|
89
|
-
expect(@options).to eq(user: true)
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'selects custom defaults when none' do
|
93
|
-
$cfg['sync.bydefault'] = 'role'
|
94
|
-
MrMurano::SyncRoot.instance.check_same(@options)
|
95
|
-
expect(@options).to eq(role: true)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'builds option params' do
|
99
|
-
ret = []
|
100
|
-
MrMurano::SyncRoot.instance.each_option do |s, l, d|
|
101
|
-
ret << [s, l, d]
|
102
|
-
end
|
103
|
-
expect(ret).to eq(
|
104
|
-
[
|
105
|
-
['-U', '--[no-]user', 'describe user'],
|
106
|
-
['-G', '--[no-]role', 'describe role'],
|
107
|
-
]
|
108
|
-
)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|