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
data/spec/Content_spec.rb
DELETED
@@ -1,422 +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 'fileutils'
|
9
|
-
require 'pathname'
|
10
|
-
require 'MrMurano/version'
|
11
|
-
require 'MrMurano/Content'
|
12
|
-
require 'MrMurano/HttpAuthed'
|
13
|
-
require 'MrMurano/SyncRoot'
|
14
|
-
require '_workspace'
|
15
|
-
require 'HttpAuthed_spec'
|
16
|
-
|
17
|
-
# rubocop:disable Style/HashSyntax
|
18
|
-
# - 'Use the new Ruby 1.9 hash syntax.'
|
19
|
-
# E.g.,
|
20
|
-
# :'x-amz-meta-name' => 'Solutionfile.json',
|
21
|
-
# because quoted string keys, e.g.,
|
22
|
-
# 'x-amz-meta-name': 'Solutionfile.json',
|
23
|
-
# are not supported in Ruby 2.0.
|
24
|
-
|
25
|
-
RSpec.describe MrMurano::Content::Base do
|
26
|
-
include_context 'WORKSPACE'
|
27
|
-
|
28
|
-
before(:example) do
|
29
|
-
$cfg = MrMurano::Config.new
|
30
|
-
$cfg.load
|
31
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
32
|
-
$cfg['product.id'] = 'XYZ'
|
33
|
-
$cfg['tool.no-progress'] = true
|
34
|
-
stub_request_email_password
|
35
|
-
|
36
|
-
@ct = MrMurano::Content::Base.new
|
37
|
-
MrMurano::HttpAuthed.instance.instance_variable_set(:@token_biz, 'TTTTTTTTTT')
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'initializes' do
|
41
|
-
uri = @ct.endpoint('/')
|
42
|
-
expect(uri.to_s).to eq('https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/')
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'lists' do
|
46
|
-
body = [{
|
47
|
-
type: 'binary/octet-stream',
|
48
|
-
length: 5622,
|
49
|
-
last_modified: '2017-02-10T17:43:45.000Z',
|
50
|
-
id: 'TODO.taskpaper',
|
51
|
-
},]
|
52
|
-
|
53
|
-
stub_request(:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item?full=true')
|
54
|
-
.to_return(body: body.to_json)
|
55
|
-
|
56
|
-
ret = @ct.list
|
57
|
-
expect(ret).to eq(body)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'clears all' do
|
61
|
-
stub_request(:delete, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item')
|
62
|
-
ret = @ct.clear_all
|
63
|
-
expect(ret).to eq({})
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'fetches info for one' do
|
67
|
-
body = {
|
68
|
-
type: 'binary/octet-stream',
|
69
|
-
length: 5622,
|
70
|
-
last_modified: '2017-02-10T17:43:45.000Z',
|
71
|
-
id: 'TODO.taskpaper',
|
72
|
-
}
|
73
|
-
|
74
|
-
stub_request(
|
75
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper'
|
76
|
-
).to_return(body: body.to_json)
|
77
|
-
|
78
|
-
ret = @ct.fetch('TODO.taskpaper')
|
79
|
-
expect(ret).to eq(body)
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'removes one' do
|
83
|
-
stub_request(
|
84
|
-
:delete, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper'
|
85
|
-
)
|
86
|
-
|
87
|
-
ret = @ct.remove('TODO.taskpaper')
|
88
|
-
expect(ret).to eq({})
|
89
|
-
end
|
90
|
-
|
91
|
-
context 'uploads' do
|
92
|
-
before(:example) do
|
93
|
-
@tup = Pathname.new(@project_dir) + 'Solutionfile.json'
|
94
|
-
FileUtils.copy(File.join(@testdir, 'spec/fixtures/SolutionFiles/basic.json'), @tup.to_path)
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'uploads file' do
|
98
|
-
body = {
|
99
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
100
|
-
method: 'POST',
|
101
|
-
inputs: {
|
102
|
-
:'x-amz-meta-name' => 'Solutionfile.json',
|
103
|
-
:'x-amz-signature' => 'Bunch of Hex',
|
104
|
-
:'x-amz-date' => '20170214T200752Z',
|
105
|
-
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
106
|
-
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
107
|
-
policy: 'something base64 encoded.',
|
108
|
-
key: 'XXX/ZZZ',
|
109
|
-
acl: 'authenticated-read',
|
110
|
-
},
|
111
|
-
id: 'more Hex',
|
112
|
-
field: 'file',
|
113
|
-
enctype: 'multipart/form-data',
|
114
|
-
}
|
115
|
-
stub_request(
|
116
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
117
|
-
).with(
|
118
|
-
query: {
|
119
|
-
expires_in: 30,
|
120
|
-
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
121
|
-
type: 'application/json',
|
122
|
-
}
|
123
|
-
).to_return(body: body.to_json)
|
124
|
-
|
125
|
-
stub_request(
|
126
|
-
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
127
|
-
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
128
|
-
request.body =~ /something base64 encoded/
|
129
|
-
end.to_return(status: 200)
|
130
|
-
|
131
|
-
@ct.upload('Solutionfile.json', @tup.to_path)
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'uploads with tags' do
|
135
|
-
body = {
|
136
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
137
|
-
method: 'POST',
|
138
|
-
inputs: {
|
139
|
-
:'x-amz-meta-name' => 'Solutionfile.json',
|
140
|
-
:'x-amz-signature' => 'Bunch of Hex',
|
141
|
-
:'x-amz-date' => '20170214T200752Z',
|
142
|
-
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
143
|
-
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
144
|
-
policy: 'something base64 encoded.',
|
145
|
-
key: 'XXX/ZZZ',
|
146
|
-
acl: 'authenticated-read',
|
147
|
-
},
|
148
|
-
id: 'more Hex',
|
149
|
-
field: 'file',
|
150
|
-
enctype: 'multipart/form-data',
|
151
|
-
}
|
152
|
-
tags = { one: 12, four: 'bob' }
|
153
|
-
stub_request(
|
154
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
155
|
-
).with(
|
156
|
-
query: {
|
157
|
-
expires_in: 30,
|
158
|
-
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
159
|
-
type: 'application/json',
|
160
|
-
tags: tags.to_json,
|
161
|
-
}
|
162
|
-
).to_return(body: body.to_json)
|
163
|
-
|
164
|
-
stub_request(
|
165
|
-
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
166
|
-
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
167
|
-
request.body =~ /something base64 encoded/
|
168
|
-
end.to_return(status: 200)
|
169
|
-
|
170
|
-
@ct.upload('Solutionfile.json', @tup.to_path, tags)
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'uploads fail at S3' do
|
174
|
-
body = {
|
175
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
176
|
-
method: 'POST',
|
177
|
-
inputs: {
|
178
|
-
:'x-amz-meta-name' => 'Solutionfile.json',
|
179
|
-
:'x-amz-signature' => 'Bunch of Hex',
|
180
|
-
:'x-amz-date' => '20170214T200752Z',
|
181
|
-
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
182
|
-
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
183
|
-
policy: 'something base64 encoded.',
|
184
|
-
key: 'XXX/ZZZ',
|
185
|
-
acl: 'authenticated-read',
|
186
|
-
},
|
187
|
-
id: 'more Hex',
|
188
|
-
field: 'file',
|
189
|
-
enctype: 'multipart/form-data',
|
190
|
-
}
|
191
|
-
stub_request(
|
192
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
193
|
-
).with(
|
194
|
-
query: {
|
195
|
-
expires_in: 30,
|
196
|
-
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
197
|
-
type: 'application/json',
|
198
|
-
}
|
199
|
-
).to_return(body: body.to_json)
|
200
|
-
|
201
|
-
stub_request(
|
202
|
-
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
203
|
-
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
204
|
-
request.body =~ /something base64 encoded/
|
205
|
-
end.to_return(status: 500)
|
206
|
-
|
207
|
-
saved = $stderr
|
208
|
-
$stderr = StringIO.new
|
209
|
-
|
210
|
-
@ct.upload('Solutionfile.json', @tup.to_path)
|
211
|
-
expect($stderr.string).to eq("\e[31mRequest Failed: 500: nil\e[0m\n")
|
212
|
-
$stderr = saved
|
213
|
-
end
|
214
|
-
|
215
|
-
it 'uploads with --dry' do
|
216
|
-
body = {
|
217
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
218
|
-
method: 'POST',
|
219
|
-
inputs: {
|
220
|
-
:'x-amz-meta-name' => 'resources.yaml',
|
221
|
-
:'x-amz-signature' => 'Bunch of Hex',
|
222
|
-
:'x-amz-date' => '20170214T200752Z',
|
223
|
-
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
224
|
-
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
225
|
-
policy: 'something base64 encoded.',
|
226
|
-
key: 'XXX/ZZZ',
|
227
|
-
acl: 'authenticated-read',
|
228
|
-
},
|
229
|
-
id: 'more Hex',
|
230
|
-
field: 'file',
|
231
|
-
enctype: 'multipart/form-data',
|
232
|
-
}
|
233
|
-
stub_request(
|
234
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
235
|
-
).with(
|
236
|
-
query: {
|
237
|
-
expires_in: 30,
|
238
|
-
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
239
|
-
type: 'application/json',
|
240
|
-
}
|
241
|
-
).to_return(body: body.to_json)
|
242
|
-
|
243
|
-
$cfg['tool.dry'] = true
|
244
|
-
saved = $stdout
|
245
|
-
$stdout = StringIO.new
|
246
|
-
@ct.upload('Solutionfile.json', @tup.to_path)
|
247
|
-
expect($stdout.string.lines).to match_array(
|
248
|
-
[
|
249
|
-
"--dry: Not uploading item: ‘Solutionfile.json’\n",
|
250
|
-
]
|
251
|
-
)
|
252
|
-
$stdout = saved
|
253
|
-
end
|
254
|
-
|
255
|
-
it 'uploads with --curl' do
|
256
|
-
body = {
|
257
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging',
|
258
|
-
method: 'POST',
|
259
|
-
inputs: {
|
260
|
-
:'x-amz-meta-name' => 'Solutionfile.json',
|
261
|
-
:'x-amz-signature' => 'Bunch of Hex',
|
262
|
-
:'x-amz-date' => '20170214T200752Z',
|
263
|
-
:'x-amz-credential' => 'AAA/BBB/us-west-1/s3/aws4_request',
|
264
|
-
:'x-amz-algorithm' => 'AWS4-HMAC-SHA256',
|
265
|
-
policy: 'something base64 encoded.',
|
266
|
-
key: 'XXX/ZZZ',
|
267
|
-
acl: 'authenticated-read',
|
268
|
-
},
|
269
|
-
id: 'more Hex',
|
270
|
-
field: 'file',
|
271
|
-
enctype: 'multipart/form-data',
|
272
|
-
}
|
273
|
-
stub_request(
|
274
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Solutionfile.json/upload'
|
275
|
-
).with(
|
276
|
-
query: {
|
277
|
-
expires_in: 30,
|
278
|
-
# FIXME/2018-04-17: (lb): Still sha256? Or md5 now?
|
279
|
-
sha256: '018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136',
|
280
|
-
type: 'application/json',
|
281
|
-
}
|
282
|
-
).to_return(body: body.to_json)
|
283
|
-
|
284
|
-
stub_request(
|
285
|
-
:post, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging'
|
286
|
-
).with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
|
287
|
-
request.body =~ /something base64 encoded/
|
288
|
-
end.to_return(status: 200)
|
289
|
-
|
290
|
-
saved = $stdout
|
291
|
-
$stdout = StringIO.new
|
292
|
-
|
293
|
-
$cfg['tool.curldebug'] = true
|
294
|
-
$cfg['tool.curlfancy'] = false
|
295
|
-
$cfg.curlfile_f = nil
|
296
|
-
@ct.upload('Solutionfile.json', @tup.to_path)
|
297
|
-
expect($stdout.string).to match(%r{curl -s -H 'Authorization: token TTTTTTTTTT' -H 'User-Agent: MrMurano/[^']+' -H 'Content-Type: application/json' -X GET 'https://bizapi\.hosted\.exosite\.io/api:1/service/XYZ/content/item/Solutionfile\.json/upload\?sha256=018d1e072e1e9734cbc804c27121d00a2912fe14bcc11244e3fc20c5b72ab136&expires_in=30&type=application%2Fjson'\ncurl -s -H 'User-Agent: MrMurano/[^']+' -X POST 'https://s3-us-west-1\.amazonaws\.com/murano-content-service-staging' -F 'x-amz-meta-name=Solutionfile\.json' -F 'x-amz-signature=Bunch of Hex' -F 'x-amz-date=20170214T200752Z' -F 'x-amz-credential=AAA/BBB/us-west-1/s3/aws4_request' -F 'x-amz-algorithm=AWS4-HMAC-SHA256' -F 'policy=something base64 encoded\.' -F 'key=XXX/ZZZ' -F 'acl=authenticated-read' -F file=@.*/home/work/project/Solutionfile\.json\n})
|
298
|
-
$stdout = saved
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
context 'downloads' do
|
303
|
-
it 'something to stdout' do
|
304
|
-
body = {
|
305
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
306
|
-
method: 'GET',
|
307
|
-
id: '8076e5d091844814d7f5cd97a1a730aa',
|
308
|
-
}
|
309
|
-
|
310
|
-
stub_request(
|
311
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
312
|
-
).to_return(body: body.to_json)
|
313
|
-
|
314
|
-
stub_request(
|
315
|
-
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
316
|
-
).to_return(body: 'FOOOOOOOOOOOO')
|
317
|
-
|
318
|
-
# This test does not work with curldebug enabled.
|
319
|
-
$cfg['tool.curldebug'] = false
|
320
|
-
$cfg['tool.curlfancy'] = false
|
321
|
-
$cfg.curlfile_f = nil
|
322
|
-
|
323
|
-
saved = $stdout
|
324
|
-
$stdout = StringIO.new
|
325
|
-
|
326
|
-
@ct.download('TODO.taskpaper')
|
327
|
-
expect($stdout.string).to eq('FOOOOOOOOOOOO')
|
328
|
-
$stdout = saved
|
329
|
-
end
|
330
|
-
|
331
|
-
it 'something to block' do
|
332
|
-
body = {
|
333
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
334
|
-
method: 'GET',
|
335
|
-
id: '8076e5d091844814d7f5cd97a1a730aa',
|
336
|
-
}
|
337
|
-
|
338
|
-
stub_request(
|
339
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
340
|
-
).to_return(body: body.to_json)
|
341
|
-
|
342
|
-
stub_request(
|
343
|
-
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
344
|
-
).to_return(body: 'FOOOOOOOOOOOO')
|
345
|
-
|
346
|
-
expect do |b|
|
347
|
-
@ct.download('TODO.taskpaper', &b)
|
348
|
-
end.to yield_with_args('FOOOOOOOOOOOO')
|
349
|
-
end
|
350
|
-
|
351
|
-
it "something that isn't there" do
|
352
|
-
# bizapi/content/download always returns GET instructions? yes.
|
353
|
-
body = {
|
354
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
355
|
-
method: 'GET',
|
356
|
-
id: '8076e5d091844814d7f5cd97a1a730aa',
|
357
|
-
}
|
358
|
-
|
359
|
-
stub_request(
|
360
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/Notthere/download'
|
361
|
-
).to_return(body: body.to_json)
|
362
|
-
|
363
|
-
resp = %(
|
364
|
-
<?xml version='1.0' encoding='UTF-8'?>
|
365
|
-
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>XXX/ZZZ</Key><RequestId>12</RequestId><HostId>=</HostId></Error>
|
366
|
-
)
|
367
|
-
stub_request(
|
368
|
-
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
369
|
-
).to_return(status: 404, body: resp)
|
370
|
-
|
371
|
-
saved = $stderr
|
372
|
-
$stderr = StringIO.new
|
373
|
-
|
374
|
-
ret = @ct.download('Notthere')
|
375
|
-
expect(ret).to match(Net::HTTPNotFound)
|
376
|
-
expect($stderr.string).to eq("\e[31mRequest Failed: 404: #{resp}\e[0m\n")
|
377
|
-
$stderr = saved
|
378
|
-
end
|
379
|
-
|
380
|
-
it 'something to block with --curl' do
|
381
|
-
body = {
|
382
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
383
|
-
method: 'GET',
|
384
|
-
id: '8076e5d091844814d7f5cd97a1a730aa',
|
385
|
-
}
|
386
|
-
|
387
|
-
stub_request(
|
388
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
389
|
-
).to_return(body: body.to_json)
|
390
|
-
|
391
|
-
stub_request(
|
392
|
-
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
393
|
-
).to_return(body: 'FOOOOOOOOOOOO')
|
394
|
-
|
395
|
-
saved = $stdout
|
396
|
-
$stdout = StringIO.new
|
397
|
-
|
398
|
-
$cfg['tool.curldebug'] = true
|
399
|
-
$cfg['tool.curlfancy'] = false
|
400
|
-
$cfg.curlfile_f = nil
|
401
|
-
@ct.download('TODO.taskpaper')
|
402
|
-
expect($stdout.string).to match(%r{curl -s -H 'Authorization: token TTTTTTTTTT' -H 'User-Agent: MrMurano/[^']+' -H 'Content-Type: application/json' -X GET 'https://bizapi\.hosted\.exosite\.io/api:1/service/XYZ/content/item/TODO\.taskpaper/download'\ncurl -s -H 'User-Agent: MrMurano/[^']+' -X GET 'https://s3-us-west-1\.amazonaws\.com/murano-content-service-staging/XXX/ZZZ'\nFOOOOOOOOOOOO})
|
403
|
-
$stdout = saved
|
404
|
-
end
|
405
|
-
|
406
|
-
it 'something to block with --dry' do
|
407
|
-
body = {
|
408
|
-
url: 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ',
|
409
|
-
method: 'GET',
|
410
|
-
id: '8076e5d091844814d7f5cd97a1a730aa',
|
411
|
-
}
|
412
|
-
|
413
|
-
stub_request(
|
414
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/content/item/TODO.taskpaper/download'
|
415
|
-
).to_return(body: body.to_json)
|
416
|
-
|
417
|
-
$cfg['tool.dry'] = true
|
418
|
-
@ct.download('TODO.taskpaper')
|
419
|
-
end
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
data/spec/GatewayBase_spec.rb
DELETED
@@ -1,65 +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 'fileutils'
|
9
|
-
require 'MrMurano/version'
|
10
|
-
require 'MrMurano/HttpAuthed'
|
11
|
-
require 'MrMurano/Gateway'
|
12
|
-
require 'MrMurano/SyncRoot'
|
13
|
-
require '_workspace'
|
14
|
-
require 'HttpAuthed_spec'
|
15
|
-
|
16
|
-
RSpec.describe MrMurano::Gateway::GweBase do
|
17
|
-
include_context 'WORKSPACE'
|
18
|
-
|
19
|
-
before(:example) do
|
20
|
-
$cfg = MrMurano::Config.new
|
21
|
-
$cfg.load
|
22
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
23
|
-
$cfg['product.id'] = 'XYZ'
|
24
|
-
stub_request_email_password
|
25
|
-
|
26
|
-
@gw = MrMurano::Gateway::GweBase.new
|
27
|
-
MrMurano::HttpAuthed.instance.instance_variable_set(:@token_biz, 'TTTTTTTTTT')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'initializes' do
|
31
|
-
uri = @gw.endpoint('/')
|
32
|
-
expect(uri.to_s).to eq('https://bizapi.hosted.exosite.io/api:1/service/XYZ/device2/')
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'gets info' do
|
36
|
-
body = {
|
37
|
-
name: 'XXXXXXXX',
|
38
|
-
protocol: { name: 'onep', auth_type: 'cik' },
|
39
|
-
description: 'XXXXXXXX',
|
40
|
-
identity_format: {
|
41
|
-
prefix: '', type: 'opaque', options: { casing: 'mixed', length: 0 },
|
42
|
-
},
|
43
|
-
fqdn: 'XXXXXXXX.m2.exosite-staging.io',
|
44
|
-
provisioning: {
|
45
|
-
enabled: true,
|
46
|
-
generate_identity: true,
|
47
|
-
presenter_identity: true,
|
48
|
-
ip_whitelisting: { enabled: false, allowed: [] },
|
49
|
-
},
|
50
|
-
resources: {
|
51
|
-
bob: { format: 'string', unit: 'c', settable: true },
|
52
|
-
fuzz: { format: 'string', unit: 'c', settable: true },
|
53
|
-
gruble: { format: 'string', unit: 'bits', settable: true },
|
54
|
-
},
|
55
|
-
}
|
56
|
-
stub_request(
|
57
|
-
:get, 'https://bizapi.hosted.exosite.io/api:1/service/XYZ/device2'
|
58
|
-
).with(
|
59
|
-
headers: { 'Authorization' => 'token TTTTTTTTTT', 'Content-Type' => 'application/json' }
|
60
|
-
).to_return(status: 200, body: body.to_json, headers: {})
|
61
|
-
ret = @gw.info
|
62
|
-
expect(ret).to eq(body)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|