Esempio n. 1
0
 def test_python_action_wrapper_action_script_file_contains_invalid_syntax_friendly_error(self):
     wrapper = PythonActionWrapper(pack='dummy_pack_5', file_path=ACTION_2_PATH,
                                   user='******')
     expected_msg = ('Failed to load action class from file ".*?invalid_syntax.py" '
                    '\(action file most likely doesn\'t exist or contains invalid syntax\): '
                    'No module named \'?invalid\'?')
     self.assertRaisesRegexp(Exception, expected_msg, wrapper._get_action_instance)
Esempio n. 2
0
    def test_python_action_wrapper_action_script_file_doesnt_exist_friendly_error(self):
        # File in a directory which is not a Python package
        wrapper = PythonActionWrapper(pack='dummy_pack_5', file_path='/tmp/doesnt.exist',
                                      user='******')

        expected_msg = 'File "/tmp/doesnt.exist" has no action class or the file doesn\'t exist.'
        self.assertRaisesRegexp(Exception, expected_msg, wrapper._get_action_instance)

        # File in a directory which is a Python package
        wrapper = PythonActionWrapper(pack='dummy_pack_5', file_path=ACTION_1_PATH,
                                      user='******')

        expected_msg = ('Failed to load action class from file ".*?list_repos_doesnt_exist.py" '
                       '\(action file most likely doesn\'t exist or contains invalid syntax\): '
                       '\[Errno 2\] No such file or directory')
        self.assertRaisesRegexp(Exception, expected_msg, wrapper._get_action_instance)