roku_builder 3.13.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +12 -0
- data/Gemfile.lock +22 -7
- data/Guardfile +3 -3
- data/README.md +22 -398
- data/bin/roku +1 -194
- data/config.json.example +1 -1
- data/intergration/roku_builder/test_core.rb +52 -0
- data/intergration/roku_builder/test_files/core_intergration_test/manifest_template +7 -0
- data/intergration/roku_builder/test_files/core_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/components/rectanglescene.xml +28 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/source/main.brs +23 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_helper.rb +138 -0
- data/intergration/roku_builder/test_inspector.rb +35 -0
- data/intergration/roku_builder/test_linker.rb +32 -0
- data/intergration/roku_builder/test_loader.rb +38 -0
- data/intergration/roku_builder/test_monitor.rb +21 -0
- data/intergration/roku_builder/test_navigator.rb +34 -0
- data/intergration/roku_builder/test_packager.rb +41 -0
- data/intergration/roku_builder/test_profiler.rb +48 -0
- data/intergration/roku_builder/test_scripter.rb +38 -0
- data/intergration/roku_builder/test_tester.rb +21 -0
- data/lib/roku_builder.rb +143 -154
- data/lib/roku_builder/config.rb +17 -40
- data/lib/roku_builder/config_parser.rb +49 -200
- data/lib/roku_builder/config_validator.rb +1 -1
- data/lib/roku_builder/errors.rb +12 -0
- data/lib/roku_builder/git.rb +28 -0
- data/lib/roku_builder/hash.rb +8 -0
- data/lib/roku_builder/manifest.rb +121 -0
- data/lib/roku_builder/options.rb +68 -29
- data/lib/roku_builder/plugin.rb +30 -0
- data/lib/roku_builder/plugins/core.rb +117 -0
- data/lib/roku_builder/plugins/inspector.rb +104 -0
- data/lib/roku_builder/{linker.rb → plugins/linker.rb} +38 -12
- data/lib/roku_builder/plugins/loader.rb +152 -0
- data/lib/roku_builder/{monitor.rb → plugins/monitor.rb} +20 -9
- data/lib/roku_builder/{navigator.rb → plugins/navigator.rb} +136 -88
- data/lib/roku_builder/plugins/packager.rb +194 -0
- data/lib/roku_builder/plugins/profiler.rb +135 -0
- data/lib/roku_builder/plugins/scripter.rb +53 -0
- data/lib/roku_builder/{tester.rb → plugins/tester.rb} +28 -19
- data/lib/roku_builder/stager.rb +48 -12
- data/lib/roku_builder/string.rb +20 -0
- data/lib/roku_builder/util.rb +10 -34
- data/lib/roku_builder/version.rb +1 -1
- data/rakefile +5 -1
- data/roku_builder.gemspec +2 -0
- data/test/roku_builder/plugins/test_core.rb +112 -0
- data/test/roku_builder/plugins/test_inspector.rb +165 -0
- data/test/roku_builder/plugins/test_linker.rb +123 -0
- data/test/roku_builder/plugins/test_loader.rb +115 -0
- data/test/roku_builder/plugins/test_monitor.rb +141 -0
- data/test/roku_builder/plugins/test_navigator.rb +274 -0
- data/test/roku_builder/plugins/test_packager.rb +202 -0
- data/test/roku_builder/plugins/test_profiler.rb +127 -0
- data/test/roku_builder/plugins/test_scripter.rb +110 -0
- data/test/roku_builder/plugins/test_tester.rb +109 -0
- data/test/roku_builder/test_config.rb +51 -35
- data/test/roku_builder/test_config_parser.rb +76 -154
- data/test/roku_builder/test_config_validator.rb +18 -1
- data/test/roku_builder/test_files/{loader_test/manifest → config_parser_test/test.pkg} +0 -0
- data/test/roku_builder/test_files/config_test/config.json +3 -0
- data/test/roku_builder/test_files/controller_commands_test/manifest_template +7 -0
- data/test/roku_builder/test_files/core_test/manifest_template +7 -0
- data/test/roku_builder/test_files/core_test/test.pkg +0 -0
- data/test/roku_builder/test_files/inspector_test/manifest +6 -0
- data/test/roku_builder/test_files/inspector_test/test.pkg +0 -0
- data/test/roku_builder/test_files/linker_test/manifest +6 -0
- data/test/roku_builder/test_files/linker_test/test.pkg +0 -0
- data/test/roku_builder/test_files/loader_test/manifest_template +6 -0
- data/test/roku_builder/test_files/loader_test/test.pkg +0 -0
- data/test/roku_builder/test_files/loader_test/test.zip +0 -0
- data/test/roku_builder/test_files/manifest_test/manifest_comments +6 -0
- data/test/roku_builder/test_files/manifest_test/manifest_template +7 -0
- data/test/roku_builder/test_files/manifest_test/test.zip +0 -0
- data/test/roku_builder/test_files/packager_test/manifest +6 -0
- data/test/roku_builder/test_files/packager_test/scripter_test/manifest +6 -0
- data/test/roku_builder/test_files/packager_test/test.pkg +0 -0
- data/test/roku_builder/test_files/roku_builder_test/config.json +32 -0
- data/test/roku_builder/test_files/scripter_test/manifest +6 -0
- data/test/roku_builder/test_files/scripter_test/test.pkg +0 -0
- data/test/roku_builder/test_files/stager_test/test.pkg +0 -0
- data/test/roku_builder/test_files/tester_test/manifest +6 -0
- data/test/roku_builder/test_files/tester_test/test.pkg +0 -0
- data/test/roku_builder/test_helper.rb +44 -11
- data/test/roku_builder/test_logger.rb +1 -0
- data/test/roku_builder/test_manifest.rb +99 -0
- data/test/roku_builder/test_options.rb +106 -77
- data/test/roku_builder/test_options_plugins.rb +111 -0
- data/test/roku_builder/test_plugin.rb +48 -0
- data/test/roku_builder/test_roku_builder.rb +239 -0
- data/test/roku_builder/test_stager.rb +49 -101
- data/test/roku_builder/test_util.rb +19 -4
- metadata +241 -47
- data/lib/roku_builder/controller.rb +0 -98
- data/lib/roku_builder/controller_commands.rb +0 -224
- data/lib/roku_builder/error_handler.rb +0 -142
- data/lib/roku_builder/inspector.rb +0 -82
- data/lib/roku_builder/keyer.rb +0 -106
- data/lib/roku_builder/loader.rb +0 -131
- data/lib/roku_builder/manifest_manager.rb +0 -126
- data/lib/roku_builder/packager.rb +0 -43
- data/lib/roku_builder/profiler.rb +0 -96
- data/lib/roku_builder/scripter.rb +0 -39
- data/test/roku_builder/test_controller.rb +0 -70
- data/test/roku_builder/test_controller_commands.rb +0 -465
- data/test/roku_builder/test_error_handler.rb +0 -90
- data/test/roku_builder/test_inspector.rb +0 -298
- data/test/roku_builder/test_keyer.rb +0 -176
- data/test/roku_builder/test_linker.rb +0 -110
- data/test/roku_builder/test_loader.rb +0 -337
- data/test/roku_builder/test_manifest_manager.rb +0 -103
- data/test/roku_builder/test_monitor.rb +0 -137
- data/test/roku_builder/test_navigator.rb +0 -280
- data/test/roku_builder/test_packager.rb +0 -127
- data/test/roku_builder/test_profiler.rb +0 -35
- data/test/roku_builder/test_scripter.rb +0 -102
- data/test/roku_builder/test_tester.rb +0 -130
@@ -1,110 +0,0 @@
|
|
1
|
-
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
-
|
3
|
-
require_relative "test_helper.rb"
|
4
|
-
|
5
|
-
module RokuBuilder
|
6
|
-
class LinkerTest < Minitest::Test
|
7
|
-
def test_linker_link
|
8
|
-
connection = Minitest::Mock.new
|
9
|
-
faraday = Minitest::Mock.new
|
10
|
-
response = Minitest::Mock.new
|
11
|
-
|
12
|
-
device_config = {
|
13
|
-
ip: "111.222.333",
|
14
|
-
user: "user",
|
15
|
-
password: "password"
|
16
|
-
}
|
17
|
-
path = "/launch/dev?a=A&b=B%3AC&d=a%5Cb"
|
18
|
-
options = 'a:A, b:B:C, d:a\b'
|
19
|
-
|
20
|
-
connection.expect(:post, response, [path])
|
21
|
-
faraday.expect(:headers, {})
|
22
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
23
|
-
faraday.expect(:request, nil, [:multipart])
|
24
|
-
faraday.expect(:request, nil, [:url_encoded])
|
25
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
26
|
-
response.expect(:success?, true)
|
27
|
-
|
28
|
-
linker = Linker.new(**device_config)
|
29
|
-
success = nil
|
30
|
-
Faraday.stub(:new, connection, faraday) do
|
31
|
-
success = linker.launch(options: options)
|
32
|
-
end
|
33
|
-
|
34
|
-
assert success
|
35
|
-
|
36
|
-
connection.verify
|
37
|
-
faraday.verify
|
38
|
-
response.verify
|
39
|
-
end
|
40
|
-
def test_linker_link_nothing
|
41
|
-
connection = Minitest::Mock.new
|
42
|
-
faraday = Minitest::Mock.new
|
43
|
-
response = Minitest::Mock.new
|
44
|
-
|
45
|
-
device_config = {
|
46
|
-
ip: "111.222.333",
|
47
|
-
user: "user",
|
48
|
-
password: "password"
|
49
|
-
}
|
50
|
-
path = "/launch/dev"
|
51
|
-
options = ''
|
52
|
-
connection.expect(:post, response, [path])
|
53
|
-
faraday.expect(:headers, {})
|
54
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
55
|
-
faraday.expect(:request, nil, [:multipart])
|
56
|
-
faraday.expect(:request, nil, [:url_encoded])
|
57
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
58
|
-
response.expect(:success?, true)
|
59
|
-
linker = Linker.new(**device_config)
|
60
|
-
success = nil
|
61
|
-
Faraday.stub(:new, connection, faraday) do
|
62
|
-
success = linker.launch(options: options)
|
63
|
-
end
|
64
|
-
|
65
|
-
assert success
|
66
|
-
connection.verify
|
67
|
-
faraday.verify
|
68
|
-
response.verify
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_linker_list
|
72
|
-
connection = Minitest::Mock.new
|
73
|
-
faraday = Minitest::Mock.new
|
74
|
-
response = Minitest::Mock.new
|
75
|
-
|
76
|
-
device_config = {
|
77
|
-
ip: "111.222.333",
|
78
|
-
user: "user",
|
79
|
-
password: "password"
|
80
|
-
}
|
81
|
-
path = "/query/apps"
|
82
|
-
body = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<apps>\n\t
|
83
|
-
<app id=\"31012\" type=\"menu\" version=\"1.6.3\">Movie Store and TV Store</app>\n\t
|
84
|
-
<app id=\"31863\" type=\"menu\" version=\"1.2.6\">Roku Home News</app>\n\t
|
85
|
-
<app id=\"65066\" type=\"appl\" version=\"1.3.0\">Nick</app>\n\t
|
86
|
-
<app id=\"68161\" type=\"appl\" version=\"1.3.0\">Nick</app>\n\t
|
87
|
-
</apps>\n"
|
88
|
-
connection.expect(:get, response, [path])
|
89
|
-
faraday.expect(:headers, {})
|
90
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
91
|
-
faraday.expect(:request, nil, [:multipart])
|
92
|
-
faraday.expect(:request, nil, [:url_encoded])
|
93
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
94
|
-
response.expect(:success?, true)
|
95
|
-
response.expect(:body, body)
|
96
|
-
linker = Linker.new(**device_config)
|
97
|
-
|
98
|
-
print_count = 0
|
99
|
-
did_print = Proc.new { |msg| print_count+=1 }
|
100
|
-
|
101
|
-
Faraday.stub(:new, connection, faraday) do
|
102
|
-
linker.stub(:printf, did_print) do
|
103
|
-
linker.list
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
assert_equal 6, print_count
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,337 +0,0 @@
|
|
1
|
-
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
-
|
3
|
-
require_relative "test_helper.rb"
|
4
|
-
|
5
|
-
module RokuBuilder
|
6
|
-
class LoaderTest < Minitest::Test
|
7
|
-
def test_loader_sideload
|
8
|
-
connection = Minitest::Mock.new
|
9
|
-
faraday = Minitest::Mock.new
|
10
|
-
io = Minitest::Mock.new
|
11
|
-
response = Minitest::Mock.new
|
12
|
-
navigator = Minitest::Mock.new
|
13
|
-
|
14
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "loader_test")
|
15
|
-
device_config = {
|
16
|
-
ip: "111.222.333",
|
17
|
-
user: "user",
|
18
|
-
password: "password",
|
19
|
-
init_params: {root_dir: root_dir}
|
20
|
-
}
|
21
|
-
loader_config = {
|
22
|
-
content: {
|
23
|
-
folders: ["source"],
|
24
|
-
files: ["manifest"]
|
25
|
-
}
|
26
|
-
}
|
27
|
-
payload = {
|
28
|
-
mysubmit: "Replace",
|
29
|
-
archive: io,
|
30
|
-
}
|
31
|
-
path = "/plugin_install"
|
32
|
-
|
33
|
-
navigator.expect(:nav, nil, [commands: [:home]])
|
34
|
-
faraday.expect(:headers, {})
|
35
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
36
|
-
faraday.expect(:request, nil, [:multipart])
|
37
|
-
faraday.expect(:request, nil, [:url_encoded])
|
38
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
39
|
-
connection.expect(:post, response) do |arg1, arg2|
|
40
|
-
assert_equal path, arg1
|
41
|
-
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
42
|
-
assert payload[:archive] === arg2[:archive]
|
43
|
-
end
|
44
|
-
response.expect(:status, 200)
|
45
|
-
response.expect(:body, "Install Success")
|
46
|
-
response.expect(:status, 200)
|
47
|
-
response.expect(:body, "Install Success")
|
48
|
-
|
49
|
-
loader = Loader.new(**device_config)
|
50
|
-
result = nil
|
51
|
-
build_version = nil
|
52
|
-
ManifestManager.stub(:build_version, "build_version") do
|
53
|
-
loader.stub(:build, "zip_file") do
|
54
|
-
Faraday.stub(:new, connection, faraday) do
|
55
|
-
Faraday::UploadIO.stub(:new, io) do
|
56
|
-
File.stub(:delete, nil) do
|
57
|
-
Navigator.stub(:new, navigator) do
|
58
|
-
result, build_version = loader.sideload(**loader_config)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
assert_equal "build_version", build_version
|
67
|
-
assert_equal SUCCESS, result
|
68
|
-
|
69
|
-
connection.verify
|
70
|
-
faraday.verify
|
71
|
-
io.verify
|
72
|
-
response.verify
|
73
|
-
end
|
74
|
-
def test_loader_sideload_infile
|
75
|
-
connection = Minitest::Mock.new
|
76
|
-
faraday = Minitest::Mock.new
|
77
|
-
io = Minitest::Mock.new
|
78
|
-
response = Minitest::Mock.new
|
79
|
-
navigator = Minitest::Mock.new
|
80
|
-
|
81
|
-
infile = File.join(File.dirname(__FILE__), "test_files", "loader_test", "infile_test.zip")
|
82
|
-
device_config = {
|
83
|
-
ip: "111.222.333",
|
84
|
-
user: "user",
|
85
|
-
password: "password"
|
86
|
-
}
|
87
|
-
loader_config = {
|
88
|
-
infile: infile
|
89
|
-
}
|
90
|
-
payload = {
|
91
|
-
mysubmit: "Replace",
|
92
|
-
archive: io,
|
93
|
-
}
|
94
|
-
path = "/plugin_install"
|
95
|
-
|
96
|
-
navigator.expect(:nav, nil, [commands: [:home]])
|
97
|
-
faraday.expect(:headers, {})
|
98
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
99
|
-
faraday.expect(:request, nil, [:multipart])
|
100
|
-
faraday.expect(:request, nil, [:url_encoded])
|
101
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
102
|
-
connection.expect(:post, response) do |arg1, arg2|
|
103
|
-
assert_equal path, arg1
|
104
|
-
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
105
|
-
assert payload[:archive] === arg2[:archive]
|
106
|
-
end
|
107
|
-
response.expect(:status, 200)
|
108
|
-
response.expect(:body, "Install Success")
|
109
|
-
response.expect(:status, 200)
|
110
|
-
response.expect(:body, "Install Success")
|
111
|
-
|
112
|
-
loader = Loader.new(**device_config)
|
113
|
-
result = nil
|
114
|
-
build_version = nil
|
115
|
-
ManifestManager.stub(:build_version, "build_version") do
|
116
|
-
Faraday.stub(:new, connection, faraday) do
|
117
|
-
Faraday::UploadIO.stub(:new, io) do
|
118
|
-
File.stub(:delete, nil) do
|
119
|
-
Navigator.stub(:new, navigator) do
|
120
|
-
result, build_version = loader.sideload(**loader_config)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
assert_equal "build_version", build_version
|
128
|
-
assert_equal SUCCESS, result
|
129
|
-
|
130
|
-
connection.verify
|
131
|
-
faraday.verify
|
132
|
-
io.verify
|
133
|
-
response.verify
|
134
|
-
end
|
135
|
-
def test_loader_sideload_update
|
136
|
-
connection = Minitest::Mock.new
|
137
|
-
faraday = Minitest::Mock.new
|
138
|
-
io = Minitest::Mock.new
|
139
|
-
response = Minitest::Mock.new
|
140
|
-
navigator = Minitest::Mock.new
|
141
|
-
|
142
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "loader_test")
|
143
|
-
device_config = {
|
144
|
-
ip: "111.222.333",
|
145
|
-
user: "user",
|
146
|
-
password: "password",
|
147
|
-
init_params: {root_dir: root_dir}
|
148
|
-
}
|
149
|
-
loader_config = {
|
150
|
-
update_manifest: true,
|
151
|
-
content: {
|
152
|
-
folders: ["source"],
|
153
|
-
files: ["manifest"]
|
154
|
-
}
|
155
|
-
}
|
156
|
-
payload = {
|
157
|
-
mysubmit: "Replace",
|
158
|
-
archive: io,
|
159
|
-
}
|
160
|
-
path = "/plugin_install"
|
161
|
-
|
162
|
-
navigator.expect(:nav, nil, [commands: [:home]])
|
163
|
-
faraday.expect(:headers, {})
|
164
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
165
|
-
faraday.expect(:request, nil, [:multipart])
|
166
|
-
faraday.expect(:request, nil, [:url_encoded])
|
167
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
168
|
-
connection.expect(:post, response) do |arg1, arg2|
|
169
|
-
assert_equal path, arg1
|
170
|
-
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
171
|
-
assert payload[:archive] === arg2[:archive]
|
172
|
-
end
|
173
|
-
response.expect(:status, 200)
|
174
|
-
response.expect(:body, "Install Success")
|
175
|
-
response.expect(:status, 200)
|
176
|
-
response.expect(:body, "Install Success")
|
177
|
-
|
178
|
-
loader = Loader.new(**device_config)
|
179
|
-
result = nil
|
180
|
-
build_version = nil
|
181
|
-
ManifestManager.stub(:update_build, "build_version") do
|
182
|
-
loader.stub(:build, "zip_file") do
|
183
|
-
Faraday.stub(:new, connection, faraday) do
|
184
|
-
Faraday::UploadIO.stub(:new, io) do
|
185
|
-
File.stub(:delete, nil) do
|
186
|
-
Navigator.stub(:new, navigator) do
|
187
|
-
result, build_version = loader.sideload(**loader_config)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
assert_equal "build_version", build_version
|
196
|
-
assert_equal SUCCESS, result
|
197
|
-
|
198
|
-
connection.verify
|
199
|
-
faraday.verify
|
200
|
-
io.verify
|
201
|
-
response.verify
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_loader_build_defining_folder_and_files
|
205
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "loader_test")
|
206
|
-
device_config = {
|
207
|
-
ip: "111.222.333",
|
208
|
-
user: "user",
|
209
|
-
password: "password",
|
210
|
-
init_params: {root_dir: root_dir}
|
211
|
-
}
|
212
|
-
build_config = {
|
213
|
-
content: {
|
214
|
-
folders: ["source"],
|
215
|
-
files: ["manifest"]
|
216
|
-
}
|
217
|
-
}
|
218
|
-
loader = Loader.new(**device_config)
|
219
|
-
outfile = nil
|
220
|
-
ManifestManager.stub(:build_version, "build_version") do
|
221
|
-
outfile = loader.build(**build_config)
|
222
|
-
end
|
223
|
-
Zip::File.open(outfile) do |file|
|
224
|
-
assert file.find_entry("manifest") != nil
|
225
|
-
assert_nil file.find_entry("a")
|
226
|
-
assert file.find_entry("source/b") != nil
|
227
|
-
assert file.find_entry("source/c/d") != nil
|
228
|
-
end
|
229
|
-
end
|
230
|
-
def test_loader_build_all_contents
|
231
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "loader_test")
|
232
|
-
device_config = {
|
233
|
-
ip: "111.222.333",
|
234
|
-
user: "user",
|
235
|
-
password: "password",
|
236
|
-
init_params: {root_dir: root_dir}
|
237
|
-
}
|
238
|
-
build_config = {}
|
239
|
-
loader = Loader.new(**device_config)
|
240
|
-
outfile = nil
|
241
|
-
ManifestManager.stub(:build_version, "build_version") do
|
242
|
-
outfile = loader.build(**build_config)
|
243
|
-
end
|
244
|
-
Zip::File.open(outfile) do |file|
|
245
|
-
assert file.find_entry("manifest") != nil
|
246
|
-
assert file.find_entry("a") != nil
|
247
|
-
assert file.find_entry("source/b") != nil
|
248
|
-
assert file.find_entry("source/c/d") != nil
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_loader_unload
|
253
|
-
connection = Minitest::Mock.new
|
254
|
-
faraday = Minitest::Mock.new
|
255
|
-
response = Minitest::Mock.new
|
256
|
-
|
257
|
-
device_config = {
|
258
|
-
ip: "111.222.333",
|
259
|
-
user: "user",
|
260
|
-
password: "password",
|
261
|
-
init_params: {root_dir: "/dev/null"}
|
262
|
-
}
|
263
|
-
payload = {
|
264
|
-
mysubmit: "Delete",
|
265
|
-
archive: "",
|
266
|
-
}
|
267
|
-
path = "/plugin_install"
|
268
|
-
|
269
|
-
faraday.expect(:headers, {})
|
270
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
271
|
-
faraday.expect(:request, nil, [:multipart])
|
272
|
-
faraday.expect(:request, nil, [:url_encoded])
|
273
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
274
|
-
connection.expect(:post, response) do |arg1, arg2|
|
275
|
-
assert_equal path, arg1
|
276
|
-
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
277
|
-
assert payload[:archive] === arg2[:archive]
|
278
|
-
end
|
279
|
-
response.expect(:status, 200)
|
280
|
-
response.expect(:body, "Install Success")
|
281
|
-
|
282
|
-
loader = Loader.new(**device_config)
|
283
|
-
result = nil
|
284
|
-
Faraday.stub(:new, connection, faraday) do
|
285
|
-
result = loader.unload
|
286
|
-
end
|
287
|
-
|
288
|
-
assert result
|
289
|
-
|
290
|
-
connection.verify
|
291
|
-
faraday.verify
|
292
|
-
response.verify
|
293
|
-
end
|
294
|
-
def test_loader_unload_fail
|
295
|
-
connection = Minitest::Mock.new
|
296
|
-
faraday = Minitest::Mock.new
|
297
|
-
response = Minitest::Mock.new
|
298
|
-
|
299
|
-
device_config = {
|
300
|
-
ip: "111.222.333",
|
301
|
-
user: "user",
|
302
|
-
password: "password",
|
303
|
-
init_params: {root_dir: "/dev/null"}
|
304
|
-
}
|
305
|
-
payload = {
|
306
|
-
mysubmit: "Delete",
|
307
|
-
archive: "",
|
308
|
-
}
|
309
|
-
path = "/plugin_install"
|
310
|
-
|
311
|
-
faraday.expect(:headers, {})
|
312
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
313
|
-
faraday.expect(:request, nil, [:multipart])
|
314
|
-
faraday.expect(:request, nil, [:url_encoded])
|
315
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
316
|
-
connection.expect(:post, response) do |arg1, arg2|
|
317
|
-
assert_equal path, arg1
|
318
|
-
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
319
|
-
assert payload[:archive] === arg2[:archive]
|
320
|
-
end
|
321
|
-
response.expect(:status, 200)
|
322
|
-
response.expect(:body, "Install Filed")
|
323
|
-
|
324
|
-
loader = Loader.new(**device_config)
|
325
|
-
result = nil
|
326
|
-
Faraday.stub(:new, connection, faraday) do
|
327
|
-
result = loader.unload
|
328
|
-
end
|
329
|
-
|
330
|
-
assert !result
|
331
|
-
|
332
|
-
connection.verify
|
333
|
-
faraday.verify
|
334
|
-
response.verify
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
-
|
3
|
-
require_relative "test_helper.rb"
|
4
|
-
module RokuBuilder
|
5
|
-
class ManifestManagerTest < Minitest::Test
|
6
|
-
def test_manifest_manager_update
|
7
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
8
|
-
FileUtils.cp(File.join(root_dir, "manifest_template"), File.join(root_dir, "manifest"))
|
9
|
-
build_version = nil
|
10
|
-
Time.stub(:now, Time.new(2001, 02, 01)) do
|
11
|
-
build_version = ManifestManager.update_build(root_dir: root_dir)
|
12
|
-
end
|
13
|
-
assert_equal "020101.2", build_version
|
14
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_manifest_manager_update_single_part_build_number
|
18
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
19
|
-
FileUtils.cp(File.join(root_dir, "manifest_template_2"), File.join(root_dir, "manifest"))
|
20
|
-
build_version = ManifestManager.update_build(root_dir: root_dir)
|
21
|
-
assert_equal "2", build_version
|
22
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_manifest_manager_build_version
|
26
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
27
|
-
FileUtils.cp(File.join(root_dir, "manifest_template"), File.join(root_dir, "manifest"))
|
28
|
-
build_version = nil
|
29
|
-
build_version = ManifestManager.build_version(root_dir: root_dir)
|
30
|
-
assert_equal "010101.1", build_version
|
31
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_manifest_manager_build_version_zip
|
35
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test", "test.zip")
|
36
|
-
build_version = nil
|
37
|
-
build_version = ManifestManager.build_version(root_dir: root_dir)
|
38
|
-
assert_equal "010101.1", build_version
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_manifest_manager_update_manifest
|
42
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
43
|
-
FileUtils.cp(File.join(root_dir, "manifest_template"), File.join(root_dir, "manifest"))
|
44
|
-
attrs = {
|
45
|
-
title: "New Title",
|
46
|
-
major_version: 2,
|
47
|
-
minor_version: 2,
|
48
|
-
build_version: "020202.0002",
|
49
|
-
mm_icon_focus_hd: "pkg:/images/focus1.png",
|
50
|
-
mm_icon_focus_sd: "pkg:/images/focus2.png"
|
51
|
-
}
|
52
|
-
ManifestManager.update_manifest(root_dir: root_dir, attributes: attrs)
|
53
|
-
assert FileUtils.compare_file(File.join(root_dir, "manifest"), File.join(root_dir, "updated_title_manifest"))
|
54
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
55
|
-
end
|
56
|
-
def test_manifest_manager_update_manifest_overwrite
|
57
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
58
|
-
attrs = {
|
59
|
-
title: "New Title",
|
60
|
-
major_version: 2,
|
61
|
-
minor_version: 2,
|
62
|
-
build_version: "020202.0002",
|
63
|
-
mm_icon_focus_hd: "pkg:/images/focus1.png",
|
64
|
-
mm_icon_focus_sd: "pkg:/images/focus2.png"
|
65
|
-
}
|
66
|
-
ManifestManager.update_manifest(root_dir: root_dir, attributes: attrs)
|
67
|
-
ManifestManager.update_manifest(root_dir: root_dir, attributes: attrs)
|
68
|
-
assert FileUtils.compare_file(File.join(root_dir, "manifest"), File.join(root_dir, "updated_title_manifest"))
|
69
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
70
|
-
end
|
71
|
-
def test_manifest_manager_update_manifest_partial
|
72
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
73
|
-
attrs = {
|
74
|
-
title: "New Title",
|
75
|
-
major_version: 2,
|
76
|
-
minor_version: 2,
|
77
|
-
build_version: "020202.0002",
|
78
|
-
mm_icon_focus_hd: "pkg:/images/focus1.png",
|
79
|
-
mm_icon_focus_sd: "pkg:/images/focus2.png"
|
80
|
-
}
|
81
|
-
ManifestManager.update_manifest(root_dir: root_dir, attributes: attrs)
|
82
|
-
attrs = {
|
83
|
-
title: "New Title",
|
84
|
-
}
|
85
|
-
ManifestManager.update_manifest(root_dir: root_dir, attributes: attrs)
|
86
|
-
assert FileUtils.compare_file(File.join(root_dir, "manifest"), File.join(root_dir, "updated_title_manifest"))
|
87
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
88
|
-
end
|
89
|
-
def test_manifest_manager_comment_empty
|
90
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "manifest_manager_test")
|
91
|
-
FileUtils.cp(File.join(root_dir, "manifest_comments"), File.join(root_dir, "manifest"))
|
92
|
-
result = {}
|
93
|
-
result["#comment".to_sym] = nil
|
94
|
-
result[:title] = "title"
|
95
|
-
result[:other] = ""
|
96
|
-
result[:other2] = "val#comment"
|
97
|
-
result[:other3] = "#comment"
|
98
|
-
manifest = ManifestManager.read_manifest(root_dir: root_dir)
|
99
|
-
assert_equal result, manifest
|
100
|
-
FileUtils.rm(File.join(root_dir, "manifest"))
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|