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,35 +0,0 @@
|
|
1
|
-
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
-
|
3
|
-
require_relative "test_helper.rb"
|
4
|
-
|
5
|
-
module RokuBuilder
|
6
|
-
class ProfilerTest < Minitest::Test
|
7
|
-
def test_profiler_stats
|
8
|
-
waitfor = Proc.new do |config, &blk|
|
9
|
-
assert_equal(/.+/, config["Match"])
|
10
|
-
assert_equal(5, config["Timeout"])
|
11
|
-
txt = "<All_Nodes><NodeA /><NodeB /><NodeC><NodeD /></NodeC></All_Nodes>\n"
|
12
|
-
blk.call(txt)
|
13
|
-
true
|
14
|
-
end
|
15
|
-
connection = Minitest::Mock.new
|
16
|
-
device_config = {
|
17
|
-
ip: "111.222.333",
|
18
|
-
user: "user",
|
19
|
-
password: "password"
|
20
|
-
}
|
21
|
-
profiler = Profiler.new(**device_config)
|
22
|
-
|
23
|
-
connection.expect(:puts, nil, ["sgnodes all\n"])
|
24
|
-
connection.expect(:waitfor, nil, &waitfor)
|
25
|
-
|
26
|
-
Net::Telnet.stub(:new, connection) do
|
27
|
-
profiler.stub(:printf, nil) do
|
28
|
-
profiler.run(command: :stats)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
connection.verify
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
-
|
3
|
-
require_relative "test_helper.rb"
|
4
|
-
|
5
|
-
module RokuBuilder
|
6
|
-
class Scriptertest < Minitest::Test
|
7
|
-
|
8
|
-
def test_scripter_print_bad_attr
|
9
|
-
code = Scripter.print(attribute: :bad, configs: {})
|
10
|
-
assert_equal BAD_PRINT_ATTRIBUTE, code
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_scripter_print_config_root_dir
|
14
|
-
call_count = 0
|
15
|
-
code = nil
|
16
|
-
fake_print = lambda { |message, path|
|
17
|
-
assert_equal "%s", message
|
18
|
-
assert_equal "/dev/null", path
|
19
|
-
call_count+=1
|
20
|
-
}
|
21
|
-
configs = {project_config: {directory: "/dev/null"}}
|
22
|
-
Scripter.stub(:printf, fake_print) do
|
23
|
-
code = Scripter.print(attribute: :root_dir, configs: configs)
|
24
|
-
end
|
25
|
-
assert_equal 1, call_count
|
26
|
-
assert_equal SUCCESS, code
|
27
|
-
end
|
28
|
-
def test_scripter_print_config_app_name
|
29
|
-
call_count = 0
|
30
|
-
code = nil
|
31
|
-
fake_print = lambda { |message, path|
|
32
|
-
assert_equal "%s", message
|
33
|
-
assert_equal "TestApp", path
|
34
|
-
call_count+=1
|
35
|
-
}
|
36
|
-
configs = {project_config: {app_name: "TestApp"}}
|
37
|
-
Scripter.stub(:printf, fake_print) do
|
38
|
-
code = Scripter.print(attribute: :app_name, configs: configs)
|
39
|
-
end
|
40
|
-
assert_equal 1, call_count
|
41
|
-
assert_equal SUCCESS, code
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_scripter_print_manifest_title
|
45
|
-
call_count = 0
|
46
|
-
code = nil
|
47
|
-
fake_print = lambda { |message, title|
|
48
|
-
assert_equal "%s", message
|
49
|
-
assert_equal "title", title
|
50
|
-
call_count+=1
|
51
|
-
}
|
52
|
-
manifest = {title: "title"}
|
53
|
-
configs = {project_config: {directory: "/dev/null"}}
|
54
|
-
Scripter.stub(:printf, fake_print) do
|
55
|
-
ManifestManager.stub(:read_manifest, manifest) do
|
56
|
-
code = Scripter.print(attribute: :title, configs: configs)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
assert_equal 1, call_count
|
60
|
-
assert_equal SUCCESS, code
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_scripter_print_manifest_build_version
|
64
|
-
call_count = 0
|
65
|
-
code = nil
|
66
|
-
fake_print = lambda { |message, build|
|
67
|
-
assert_equal "%s", message
|
68
|
-
assert_equal "010101.0001", build
|
69
|
-
call_count+=1
|
70
|
-
}
|
71
|
-
manifest = {build_version: "010101.0001"}
|
72
|
-
configs = {project_config: {directory: "/dev/null"}}
|
73
|
-
Scripter.stub(:printf, fake_print) do
|
74
|
-
ManifestManager.stub(:read_manifest, manifest) do
|
75
|
-
code = Scripter.print(attribute: :build_version, configs: configs)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
assert_equal 1, call_count
|
79
|
-
assert_equal SUCCESS, code
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_scripter_print_manifest_app_version
|
83
|
-
call_count = 0
|
84
|
-
code = nil
|
85
|
-
fake_print = lambda { |message, major, minor|
|
86
|
-
assert_equal "%s.%s", message
|
87
|
-
assert_equal "1", major
|
88
|
-
assert_equal "0", minor
|
89
|
-
call_count+=1
|
90
|
-
}
|
91
|
-
manifest = {major_version: "1", minor_version: "0"}
|
92
|
-
configs = {project_config: {directory: "/dev/null"}}
|
93
|
-
Scripter.stub(:printf, fake_print) do
|
94
|
-
ManifestManager.stub(:read_manifest, manifest) do
|
95
|
-
code = Scripter.print(attribute: :app_version, configs: configs)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
assert_equal 1, call_count
|
99
|
-
assert_equal SUCCESS, code
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
-
require_relative "test_helper.rb"
|
3
|
-
|
4
|
-
module RokuBuilder
|
5
|
-
class TesterTest < Minitest::Test
|
6
|
-
def test_tester_runtests
|
7
|
-
connection = Minitest::Mock.new
|
8
|
-
loader = Minitest::Mock.new
|
9
|
-
linker = Minitest::Mock.new
|
10
|
-
device_config = {
|
11
|
-
ip: "111.222.333",
|
12
|
-
user: "user",
|
13
|
-
password: "password",
|
14
|
-
init_params: {root_dir: "root/dir/path"}
|
15
|
-
}
|
16
|
-
loader_config = {
|
17
|
-
root_dir: "root/dir/path",
|
18
|
-
branch: "branch",
|
19
|
-
folders: ["source"],
|
20
|
-
files: ["manifest"]
|
21
|
-
}
|
22
|
-
tester = Tester.new(**device_config)
|
23
|
-
|
24
|
-
loader.expect(:sideload, [SUCCESS, ""], [loader_config])
|
25
|
-
linker.expect(:launch, nil, [{options: "RunTests:true"}])
|
26
|
-
connection.expect(:waitfor, nil, [/\*+\s*End testing\s*\*+/])
|
27
|
-
connection.expect(:puts, nil, ["cont\n"])
|
28
|
-
|
29
|
-
Loader.stub(:new, loader) do
|
30
|
-
Linker.stub(:new, linker) do
|
31
|
-
Net::Telnet.stub(:new, connection) do
|
32
|
-
tester.run_tests(sideload_config: loader_config)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
connection.verify
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_tester_runtests_and_handle
|
41
|
-
waitfor = Proc.new do |end_reg, &blk|
|
42
|
-
assert_equal(/\*+\s*End testing\s*\*+/, end_reg)
|
43
|
-
txt = "Fake Text"
|
44
|
-
blk.call(txt) == false
|
45
|
-
end
|
46
|
-
connection = Minitest::Mock.new
|
47
|
-
loader = Minitest::Mock.new
|
48
|
-
linker = Minitest::Mock.new
|
49
|
-
device_config = {
|
50
|
-
ip: "111.222.333",
|
51
|
-
user: "user",
|
52
|
-
password: "password",
|
53
|
-
init_params: {root_dir: "root/dir/path"}
|
54
|
-
}
|
55
|
-
loader_config = {
|
56
|
-
root_dir: "root/dir/path",
|
57
|
-
branch: "branch",
|
58
|
-
folders: ["source"],
|
59
|
-
files: ["manifest"]
|
60
|
-
}
|
61
|
-
tester = Tester.new(**device_config)
|
62
|
-
|
63
|
-
loader.expect(:sideload, [SUCCESS, ""], [loader_config])
|
64
|
-
linker.expect(:launch, nil, [{options: "RunTests:true"}])
|
65
|
-
connection.expect(:waitfor, nil, &waitfor)
|
66
|
-
connection.expect(:puts, nil, ["cont\n"])
|
67
|
-
|
68
|
-
Loader.stub(:new, loader) do
|
69
|
-
Net::Telnet.stub(:new, connection) do
|
70
|
-
Linker.stub(:new, linker) do
|
71
|
-
tester.stub(:handle_text, false) do
|
72
|
-
tester.run_tests(sideload_config: loader_config)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
connection.verify
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_tester_handle_text_no_text
|
82
|
-
device_config = {
|
83
|
-
ip: "111.222.333",
|
84
|
-
user: "user",
|
85
|
-
password: "password",
|
86
|
-
init_params: {root_dir: "root/dir/path"}
|
87
|
-
}
|
88
|
-
tester = Tester.new(**device_config)
|
89
|
-
|
90
|
-
text = "this\nis\na\ntest\nparagraph"
|
91
|
-
tester.send(:handle_text, {txt: text})
|
92
|
-
|
93
|
-
refute tester.instance_variable_get(:@in_tests)
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_tester_handle_text_all_text
|
97
|
-
device_config = {
|
98
|
-
ip: "111.222.333",
|
99
|
-
user: "user",
|
100
|
-
password: "password",
|
101
|
-
init_params: {root_dir: "root/dir/path"}
|
102
|
-
}
|
103
|
-
tester = Tester.new(**device_config)
|
104
|
-
tester.instance_variable_set(:@in_tests, true)
|
105
|
-
|
106
|
-
text = ["this","is","a","test","paragraph"]
|
107
|
-
|
108
|
-
tester.send(:handle_text, {txt: text.join("\n")})
|
109
|
-
assert_equal text, tester.instance_variable_get(:@logs)
|
110
|
-
assert tester.instance_variable_get(:@in_tests)
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_tester_handle_text_partial_text
|
114
|
-
device_config = {
|
115
|
-
ip: "111.222.333",
|
116
|
-
user: "user",
|
117
|
-
password: "password",
|
118
|
-
init_params: {root_dir: "root/dir/path"}
|
119
|
-
}
|
120
|
-
tester = Tester.new(**device_config)
|
121
|
-
|
122
|
-
text = ["this","*Start testing*","is","a","test","*End testing*","paragraph"]
|
123
|
-
verify_text = ["***************","***************","*Start testing*","is","a","test","*End testing*","*************","*************"]
|
124
|
-
|
125
|
-
tester.send(:handle_text, {txt: text.join("\n")})
|
126
|
-
refute tester.instance_variable_get(:@in_tests)
|
127
|
-
assert_equal verify_text, tester.instance_variable_get(:@logs)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|