roku_builder 3.12.8 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/CHANGELOG +9 -0
- data/Gemfile.lock +17 -11
- data/bin/roku +4 -8
- data/lib/roku_builder.rb +16 -24
- data/lib/roku_builder/config.rb +213 -0
- data/lib/roku_builder/config_parser.rb +304 -267
- data/lib/roku_builder/config_validator.rb +149 -126
- data/lib/roku_builder/controller.rb +34 -184
- data/lib/roku_builder/controller_commands.rb +85 -79
- data/lib/roku_builder/error_handler.rb +0 -11
- data/lib/roku_builder/errors.rb +12 -0
- data/lib/roku_builder/inspector.rb +6 -4
- data/lib/roku_builder/keyer.rb +1 -1
- data/lib/roku_builder/loader.rb +1 -1
- data/lib/roku_builder/logger.rb +32 -0
- data/lib/roku_builder/manifest_manager.rb +2 -2
- data/lib/roku_builder/monitor.rb +1 -1
- data/lib/roku_builder/options.rb +113 -0
- data/lib/roku_builder/stager.rb +2 -2
- data/lib/roku_builder/tester.rb +57 -11
- data/lib/roku_builder/util.rb +3 -4
- data/lib/roku_builder/version.rb +1 -1
- data/roku_builder.gemspec +2 -1
- data/test/roku_builder/test_config.rb +168 -0
- data/test/roku_builder/test_config_parser.rb +347 -394
- data/test/roku_builder/test_config_validator.rb +193 -190
- data/test/roku_builder/test_controller.rb +59 -178
- data/test/roku_builder/test_controller_commands.rb +407 -394
- data/test/roku_builder/test_error_handler.rb +67 -69
- data/test/roku_builder/test_files/config_test/bad.json +2 -0
- data/test/roku_builder/test_files/config_test/child.json +11 -0
- data/test/roku_builder/test_files/config_test/config.json +29 -0
- data/test/roku_builder/test_files/config_test/non_json.json +1 -0
- data/test/roku_builder/test_files/config_test/parent.json +21 -0
- data/test/roku_builder/test_files/config_test/parent_projects.json +35 -0
- data/test/roku_builder/test_files/manifest_manager_test/manifest_template_2 +1 -1
- data/test/roku_builder/test_helper.rb +55 -45
- data/test/roku_builder/test_inspector.rb +278 -213
- data/test/roku_builder/test_keyer.rb +144 -147
- data/test/roku_builder/test_linker.rb +91 -95
- data/test/roku_builder/test_loader.rb +279 -289
- data/test/roku_builder/test_logger.rb +47 -0
- data/test/roku_builder/test_manifest_manager.rb +92 -94
- data/test/roku_builder/test_monitor.rb +101 -103
- data/test/roku_builder/test_navigator.rb +240 -245
- data/test/roku_builder/test_options.rb +156 -0
- data/test/roku_builder/test_packager.rb +108 -108
- data/test/roku_builder/test_profiler.rb +20 -19
- data/test/roku_builder/test_scripter.rb +83 -81
- data/test/roku_builder/test_stager.rb +299 -311
- data/test/roku_builder/test_tester.rb +112 -115
- data/test/roku_builder/test_util.rb +18 -17
- metadata +39 -6
- data/lib/roku_builder/config_manager.rb +0 -161
- data/test/roku_builder/test_config_manager.rb +0 -372
@@ -0,0 +1,156 @@
|
|
1
|
+
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
+
|
3
|
+
require_relative "test_helper.rb"
|
4
|
+
|
5
|
+
module RokuBuilder
|
6
|
+
class OptionsTest < Minitest::Test
|
7
|
+
def test_options_validate_extra_commands
|
8
|
+
options = {
|
9
|
+
sideload: true,
|
10
|
+
package: true
|
11
|
+
}
|
12
|
+
assert_raises InvalidOptions do
|
13
|
+
build_options(options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
def test_options_validate_no_commands
|
17
|
+
options = {}
|
18
|
+
assert_raises InvalidOptions do
|
19
|
+
build_options(options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
def test_options_validate_extra_sources_sideload
|
23
|
+
options = {
|
24
|
+
sideload: true,
|
25
|
+
working: true,
|
26
|
+
current: true
|
27
|
+
}
|
28
|
+
assert_raises InvalidOptions do
|
29
|
+
build_options(options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
def test_options_validate_working
|
33
|
+
options = {
|
34
|
+
sideload: true,
|
35
|
+
working: true
|
36
|
+
}
|
37
|
+
build_options(options)
|
38
|
+
end
|
39
|
+
def test_options_validate_no_source
|
40
|
+
options = {
|
41
|
+
package: true
|
42
|
+
}
|
43
|
+
assert_raises InvalidOptions do
|
44
|
+
build_options(options)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
def test_options_validate_bad_current
|
48
|
+
options = {
|
49
|
+
package: true,
|
50
|
+
current: true
|
51
|
+
}
|
52
|
+
assert_raises InvalidOptions do
|
53
|
+
build_options(options)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
def test_options_validate_bad_in
|
57
|
+
options = {
|
58
|
+
package: true,
|
59
|
+
in: true
|
60
|
+
}
|
61
|
+
assert_raises InvalidOptions do
|
62
|
+
build_options(options)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
def test_options_validate_depricated
|
66
|
+
options = {
|
67
|
+
deeplink: "a:b c:d",
|
68
|
+
deeplink_depricated: true
|
69
|
+
}
|
70
|
+
build_options(options)
|
71
|
+
end
|
72
|
+
def test_options_validate_current
|
73
|
+
options = {
|
74
|
+
sideload: true,
|
75
|
+
current: true
|
76
|
+
}
|
77
|
+
build_options(options)
|
78
|
+
end
|
79
|
+
def test_options_validate_extra_sources_package
|
80
|
+
options = {
|
81
|
+
package: true,
|
82
|
+
in: "",
|
83
|
+
set_stage: true
|
84
|
+
}
|
85
|
+
assert_raises InvalidOptions do
|
86
|
+
build_options(options)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
def test_options_exclude_command_package
|
90
|
+
options = build_options({
|
91
|
+
package:true,
|
92
|
+
set_stage: true
|
93
|
+
})
|
94
|
+
assert options.exclude_command?
|
95
|
+
end
|
96
|
+
def test_options_exclude_command_build
|
97
|
+
options = build_options({
|
98
|
+
build:true,
|
99
|
+
set_stage: true
|
100
|
+
})
|
101
|
+
assert options.exclude_command?
|
102
|
+
end
|
103
|
+
def test_options_exclude_command_sideload
|
104
|
+
options = build_options({
|
105
|
+
sideload:true,
|
106
|
+
set_stage: true
|
107
|
+
})
|
108
|
+
refute options.exclude_command?
|
109
|
+
end
|
110
|
+
def test_options_source_command_sideload
|
111
|
+
options = build_options({
|
112
|
+
sideload:true,
|
113
|
+
working: true
|
114
|
+
})
|
115
|
+
assert options.source_command?
|
116
|
+
end
|
117
|
+
def test_options_source_command_deeplink
|
118
|
+
options = build_options({
|
119
|
+
deeplink: true,
|
120
|
+
})
|
121
|
+
refute options.source_command?
|
122
|
+
end
|
123
|
+
def test_options_command
|
124
|
+
options = build_options({
|
125
|
+
deeplink: true,
|
126
|
+
})
|
127
|
+
assert_equal :deeplink, options.command
|
128
|
+
end
|
129
|
+
def test_options_device_command_true
|
130
|
+
options = build_options({
|
131
|
+
deeplink: true,
|
132
|
+
})
|
133
|
+
assert options.device_command?
|
134
|
+
end
|
135
|
+
def test_options_device_command_false
|
136
|
+
options = build_options({
|
137
|
+
build: true,
|
138
|
+
working: true
|
139
|
+
})
|
140
|
+
refute options.device_command?
|
141
|
+
end
|
142
|
+
def test_options_has_source_false
|
143
|
+
options = build_options({
|
144
|
+
deeplink: true,
|
145
|
+
})
|
146
|
+
refute options.has_source?
|
147
|
+
end
|
148
|
+
def test_options_has_source_true
|
149
|
+
options = build_options({
|
150
|
+
deeplink: true,
|
151
|
+
working: true
|
152
|
+
})
|
153
|
+
assert options.has_source?
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -2,126 +2,126 @@
|
|
2
2
|
|
3
3
|
require_relative "test_helper.rb"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
response.expect(:body, "Failed: Error.")
|
43
|
-
|
44
|
-
packager = RokuBuilder::Packager.new(**device_config)
|
45
|
-
result = nil
|
46
|
-
Faraday.stub(:new, connection, faraday) do
|
47
|
-
Time.stub(:now, Time.at(0)) do
|
48
|
-
result = packager.package(**package_config)
|
5
|
+
module RokuBuilder
|
6
|
+
class PackagerTest < Minitest::Test
|
7
|
+
def test_packager_package_failed
|
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
|
+
payload = {
|
18
|
+
mysubmit: "Package",
|
19
|
+
app_name: "app_name",
|
20
|
+
passwd: "password",
|
21
|
+
pkg_time: 0
|
22
|
+
}
|
23
|
+
package_config ={
|
24
|
+
app_name_version: "app_name",
|
25
|
+
out_file: "out_file",
|
26
|
+
password: "password"
|
27
|
+
}
|
28
|
+
path = "/plugin_package"
|
29
|
+
|
30
|
+
faraday.expect(:headers, {})
|
31
|
+
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
32
|
+
faraday.expect(:request, nil, [:multipart])
|
33
|
+
faraday.expect(:request, nil, [:url_encoded])
|
34
|
+
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
35
|
+
connection.expect(:post, response) do |arg1, arg2|
|
36
|
+
assert_equal path, arg1
|
37
|
+
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
38
|
+
assert_equal payload[:app_name], arg2[:app_name]
|
39
|
+
assert_equal payload[:passwd], arg2[:passwd]
|
40
|
+
assert_equal payload[:pkg_time], arg2[:pkg_time]
|
49
41
|
end
|
50
|
-
|
42
|
+
response.expect(:body, "Failed: Error.")
|
51
43
|
|
52
|
-
|
44
|
+
packager = Packager.new(**device_config)
|
45
|
+
result = nil
|
46
|
+
Faraday.stub(:new, connection, faraday) do
|
47
|
+
Time.stub(:now, Time.at(0)) do
|
48
|
+
result = packager.package(**package_config)
|
49
|
+
end
|
50
|
+
end
|
53
51
|
|
54
|
-
|
55
|
-
faraday.verify
|
56
|
-
response.verify
|
57
|
-
end
|
52
|
+
assert_equal "Failed: Error.", result
|
58
53
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
response = Minitest::Mock.new
|
63
|
-
io = Minitest::Mock.new
|
64
|
-
|
65
|
-
device_config = {
|
66
|
-
ip: "111.222.333",
|
67
|
-
user: "user",
|
68
|
-
password: "password",
|
69
|
-
logger: Logger.new("/dev/null")
|
70
|
-
}
|
71
|
-
payload = {
|
72
|
-
mysubmit: "Package",
|
73
|
-
app_name: "app_name",
|
74
|
-
passwd: "password",
|
75
|
-
pkg_time: 0
|
76
|
-
}
|
77
|
-
package_config ={
|
78
|
-
app_name_version: "app_name",
|
79
|
-
out_file: "out_file",
|
80
|
-
password: "password"
|
81
|
-
}
|
82
|
-
path = "/plugin_package"
|
83
|
-
|
84
|
-
faraday.expect(:headers, {})
|
85
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
86
|
-
faraday.expect(:request, nil, [:multipart])
|
87
|
-
faraday.expect(:request, nil, [:url_encoded])
|
88
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
89
|
-
|
90
|
-
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
91
|
-
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
92
|
-
|
93
|
-
connection.expect(:post, response) do |arg1, arg2|
|
94
|
-
assert_equal path, arg1
|
95
|
-
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
96
|
-
assert_equal payload[:app_name], arg2[:app_name]
|
97
|
-
assert_equal payload[:passwd], arg2[:passwd]
|
98
|
-
assert_equal payload[:pkg_time], arg2[:pkg_time]
|
54
|
+
connection.verify
|
55
|
+
faraday.verify
|
56
|
+
response.verify
|
99
57
|
end
|
100
|
-
connection.expect(:get, response, ["/pkgs/pkg_url"])
|
101
58
|
|
102
|
-
|
103
|
-
|
59
|
+
def test_packager_package
|
60
|
+
connection = Minitest::Mock.new
|
61
|
+
faraday = Minitest::Mock.new
|
62
|
+
response = Minitest::Mock.new
|
63
|
+
io = Minitest::Mock.new
|
64
|
+
|
65
|
+
device_config = {
|
66
|
+
ip: "111.222.333",
|
67
|
+
user: "user",
|
68
|
+
password: "password"
|
69
|
+
}
|
70
|
+
payload = {
|
71
|
+
mysubmit: "Package",
|
72
|
+
app_name: "app_name",
|
73
|
+
passwd: "password",
|
74
|
+
pkg_time: 0
|
75
|
+
}
|
76
|
+
package_config ={
|
77
|
+
app_name_version: "app_name",
|
78
|
+
out_file: "out_file",
|
79
|
+
password: "password"
|
80
|
+
}
|
81
|
+
path = "/plugin_package"
|
82
|
+
|
83
|
+
faraday.expect(:headers, {})
|
84
|
+
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
85
|
+
faraday.expect(:request, nil, [:multipart])
|
86
|
+
faraday.expect(:request, nil, [:url_encoded])
|
87
|
+
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
88
|
+
|
89
|
+
faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
|
90
|
+
faraday.expect(:adapter, nil, [Faraday.default_adapter])
|
91
|
+
|
92
|
+
connection.expect(:post, response) do |arg1, arg2|
|
93
|
+
assert_equal path, arg1
|
94
|
+
assert_equal payload[:mysubmit], arg2[:mysubmit]
|
95
|
+
assert_equal payload[:app_name], arg2[:app_name]
|
96
|
+
assert_equal payload[:passwd], arg2[:passwd]
|
97
|
+
assert_equal payload[:pkg_time], arg2[:pkg_time]
|
98
|
+
end
|
99
|
+
connection.expect(:get, response, ["/pkgs/pkg_url"])
|
104
100
|
|
105
|
-
|
106
|
-
|
101
|
+
response.expect(:body, "<a href=\"pkgs\">pkg_url</a>")
|
102
|
+
response.expect(:body, "<a href=\"pkgs\">pkg_url</a>")
|
107
103
|
|
108
|
-
|
104
|
+
response.expect(:status, 200)
|
105
|
+
response.expect(:body, "package_body")
|
109
106
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
107
|
+
io.expect(:write, nil, ["package_body"])
|
108
|
+
|
109
|
+
packager = Packager.new(**device_config)
|
110
|
+
result = nil
|
111
|
+
Faraday.stub(:new, connection, faraday) do
|
112
|
+
Time.stub(:now, Time.at(0)) do
|
113
|
+
File.stub(:open, nil, io) do
|
114
|
+
result = packager.package(**package_config)
|
115
|
+
end
|
116
116
|
end
|
117
117
|
end
|
118
|
-
end
|
119
118
|
|
120
|
-
|
119
|
+
assert_equal true, result
|
121
120
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
connection.verify
|
122
|
+
faraday.verify
|
123
|
+
response.verify
|
124
|
+
io.verify
|
125
|
+
end
|
126
126
|
end
|
127
127
|
end
|
@@ -2,33 +2,34 @@
|
|
2
2
|
|
3
3
|
require_relative "test_helper.rb"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
module RokuBuilder
|
6
|
+
class ProfilerTest < Minitest::Test
|
7
|
+
def test_profiler_stats
|
8
|
+
waitfor = Proc.new do |config, &blk|
|
8
9
|
assert_equal(/.+/, config["Match"])
|
9
10
|
assert_equal(5, config["Timeout"])
|
10
11
|
txt = "<All_Nodes><NodeA /><NodeB /><NodeC><NodeD /></NodeC></All_Nodes>\n"
|
11
12
|
blk.call(txt)
|
12
13
|
true
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
profiler = RokuBuilder::Profiler.new(**device_config)
|
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
22
|
|
23
|
-
|
24
|
-
|
23
|
+
connection.expect(:puts, nil, ["sgnodes all\n"])
|
24
|
+
connection.expect(:waitfor, nil, &waitfor)
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
Net::Telnet.stub(:new, connection) do
|
27
|
+
profiler.stub(:printf, nil) do
|
28
|
+
profiler.run(command: :stats)
|
29
|
+
end
|
29
30
|
end
|
30
|
-
end
|
31
31
|
|
32
|
-
|
32
|
+
connection.verify
|
33
|
+
end
|
33
34
|
end
|
34
35
|
end
|
@@ -2,99 +2,101 @@
|
|
2
2
|
|
3
3
|
require_relative "test_helper.rb"
|
4
4
|
|
5
|
-
|
5
|
+
module RokuBuilder
|
6
|
+
class Scriptertest < Minitest::Test
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def test_scripter_print_bad_attr
|
9
|
+
code = Scripter.print(attribute: :bad, configs: {})
|
10
|
+
assert_equal BAD_PRINT_ATTRIBUTE, code
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
23
27
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
38
42
|
end
|
39
|
-
assert_equal 1, call_count
|
40
|
-
assert_equal RokuBuilder::SUCCESS, code
|
41
|
-
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
56
58
|
end
|
59
|
+
assert_equal 1, call_count
|
60
|
+
assert_equal SUCCESS, code
|
57
61
|
end
|
58
|
-
assert_equal 1, call_count
|
59
|
-
assert_equal RokuBuilder::SUCCESS, code
|
60
|
-
end
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
75
77
|
end
|
78
|
+
assert_equal 1, call_count
|
79
|
+
assert_equal SUCCESS, code
|
76
80
|
end
|
77
|
-
assert_equal 1, call_count
|
78
|
-
assert_equal RokuBuilder::SUCCESS, code
|
79
|
-
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
95
97
|
end
|
98
|
+
assert_equal 1, call_count
|
99
|
+
assert_equal SUCCESS, code
|
96
100
|
end
|
97
|
-
assert_equal 1, call_count
|
98
|
-
assert_equal RokuBuilder::SUCCESS, code
|
99
101
|
end
|
100
102
|
end
|