Exemplo n.º 1
0
 def scripts(self, paths_dict):
     with patch('AndroidRunner.Python3.Python3.__init__',
                return_value=None):
         test_path = 'test/path/to/script.py'
         test_config = collections.OrderedDict()
         test_config['testscript'] = test_path
         return Scripts(test_config)
Exemplo n.º 2
0
    def test_experiment_script_init(self, mock, paths_dict):
        mock.return_value = None
        test_path = 'test/path/to/script.py'
        test_config = collections.OrderedDict()
        test_config['testscript'] = test_path

        scripts = Scripts(test_config)
        mock.assert_called_once_with(op.join(paths.CONFIG_DIR, test_path))
        for script in scripts.scripts['testscript']:
            assert type(script) == Python3
Exemplo n.º 3
0
 def test_unknown_interaction_script_init(self, paths_dict):
     test_path = 'test/path/to/script.py'
     test_config = collections.OrderedDict()
     test_config['type'] = 'unknownScript'
     test_config['path'] = test_path
     test_config_list = list()
     test_config_list.append(test_config)
     interaction_test_config = collections.OrderedDict()
     interaction_test_config['interaction'] = test_config_list
     with pytest.raises(ConfigError) as _:
         Scripts(interaction_test_config)
Exemplo n.º 4
0
    def test_monkeyreplay_interaction_script_init(self, mock, paths_dict):
        mock.return_value = None
        test_path = 'test/path/to/script.py'
        test_config = collections.OrderedDict()
        test_config['type'] = 'monkeyreplay'
        test_config['path'] = test_path
        test_config_list = list()
        test_config_list.append(test_config)
        interaction_test_config = collections.OrderedDict()
        interaction_test_config['interaction'] = test_config_list
        scripts = Scripts(interaction_test_config)

        mock.assert_called_once_with(op.join(paths.CONFIG_DIR, test_path), 0, None, 'monkeyrunner')
        for script in scripts.scripts['interaction']:
            assert type(script) == MonkeyReplay
Exemplo n.º 5
0
    def test_monkeyrunner_interaction_script_init(self, mock, paths_dict):
        mock.return_value = None
        test_path = 'test/path/to/script.py'
        test_config = collections.OrderedDict()
        test_config['type'] = 'monkeyrunner'
        test_config['path'] = test_path
        test_config['timeout'] = 100
        test_config['logcat_regex'] = 'teststring'
        test_config_list = list()
        test_config_list.append(test_config)
        interaction_test_config = collections.OrderedDict()
        interaction_test_config['interaction'] = test_config_list
        scripts = Scripts(interaction_test_config, test_path)

        mock.assert_called_once_with(op.join(paths.CONFIG_DIR, test_path), 100, 'teststring', test_path)
        for script in scripts.scripts['interaction']:
            assert type(script) == MonkeyRunner