зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315704 - Test that BaseMarionetteArguments constructs arguments as expected; r=maja_zf
This commit is contained in:
Родитель
06279bca58
Коммит
af1b617e27
|
@ -4,7 +4,7 @@
|
|||
import mozunit
|
||||
import pytest
|
||||
|
||||
from marionette_harness.runtests import MarionetteArguments
|
||||
from marionette_harness.runtests import MarionetteArguments, MarionetteTestRunner
|
||||
|
||||
|
||||
@pytest.mark.parametrize("socket_timeout", ['A', '10', '1B-', '1C2', '44.35'])
|
||||
|
@ -28,5 +28,39 @@ def test_parse_arg_socket_timeout(socket_timeout):
|
|||
assert hasattr(args, 'socket_timeout') and args.socket_timeout == float(socket_timeout)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg_name, arg_dest, arg_value, expected_value",
|
||||
[('app-arg', 'app_args', 'samplevalue', ['samplevalue']),
|
||||
('symbols-path', 'symbols_path', 'samplevalue', 'samplevalue'),
|
||||
('gecko-log', 'gecko_log', 'samplevalue', 'samplevalue'),
|
||||
('app', 'app', 'samplevalue', 'samplevalue')])
|
||||
def test_parsing_optional_arguments(mach_parsed_kwargs, arg_name, arg_dest, arg_value,
|
||||
expected_value):
|
||||
parser = MarionetteArguments()
|
||||
parsed_args = parser.parse_args(['--' + arg_name, arg_value])
|
||||
result = vars(parsed_args)
|
||||
assert result.get(arg_dest) == expected_value
|
||||
mach_parsed_kwargs[arg_dest] = result[arg_dest]
|
||||
runner = MarionetteTestRunner(**mach_parsed_kwargs)
|
||||
built_kwargs = runner._build_kwargs()
|
||||
assert built_kwargs[arg_dest] == expected_value
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg_name, arg_dest, arg_value, expected_value",
|
||||
[('adb', 'adb_path', 'samplevalue', 'samplevalue'),
|
||||
('avd', 'avd', 'samplevalue', 'samplevalue'),
|
||||
('avd-home', 'avd_home', 'samplevalue', 'samplevalue'),
|
||||
('package', 'package_name', 'samplevalue', 'samplevalue')])
|
||||
def test_parse_opt_args_emulator(mach_parsed_kwargs, arg_name, arg_dest, arg_value, expected_value):
|
||||
parser = MarionetteArguments()
|
||||
parsed_args = parser.parse_args(['--' + arg_name, arg_value])
|
||||
result = vars(parsed_args)
|
||||
assert result.get(arg_dest) == expected_value
|
||||
mach_parsed_kwargs[arg_dest] = result[arg_dest]
|
||||
mach_parsed_kwargs["emulator"] = True
|
||||
runner = MarionetteTestRunner(**mach_parsed_kwargs)
|
||||
built_kwargs = runner._build_kwargs()
|
||||
assert built_kwargs[arg_dest] == expected_value
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main('--log-tbpl=-')
|
||||
|
|
Загрузка…
Ссылка в новой задаче