コード例 #1
0
ファイル: test_main.py プロジェクト: wel51x/fades
    def test_remote_child_program_ssl(self):
        with patch('fades.helpers.download_remote_script') as mock:
            mock.return_value = "new_path_script"
            analyzable, child = main.decide_child_program(False, "https://scripts.com/foobar.py")
            mock.assert_called_with("https://scripts.com/foobar.py")

        # check that analyzable and child are the same, and that its content is the remote one
        self.assertEqual(analyzable, "new_path_script")
        self.assertEqual(child, "new_path_script")
コード例 #2
0
ファイル: test_main.py プロジェクト: wel51x/fades
 def test_indicated_with_executable_flag_in_path(self):
     """Absolute paths not allowed when using --exec."""
     with self.assertRaises(FadesError):
         main.decide_child_program(True, os.path.join("path", "foobar.py"))
コード例 #3
0
ファイル: test_main.py プロジェクト: wel51x/fades
 def test_normal_child_program_not_found(self):
     with self.assertRaises(FadesError):
         main.decide_child_program(False, 'does_not_exist.py')
コード例 #4
0
ファイル: test_main.py プロジェクト: wel51x/fades
 def test_normal_child_program_no_access(self):
     child_path = create_tempfile(self, "")
     os.chmod(child_path, 333)  # Remove read permission.
     self.addCleanup(os.chmod, child_path, 644)
     with self.assertRaises(FadesError):
         main.decide_child_program(False, 'does_not_exist.py')
コード例 #5
0
ファイル: test_main.py プロジェクト: wel51x/fades
 def test_normal_child_program(self):
     child_path = create_tempfile(self, "")
     analyzable, child = main.decide_child_program(False, child_path)
     self.assertEqual(analyzable, child_path)
     self.assertEqual(child, child_path)
コード例 #6
0
ファイル: test_main.py プロジェクト: wel51x/fades
 def test_no_child_at_all(self):
     analyzable, child = main.decide_child_program(False, None)
     self.assertIsNone(analyzable)
     self.assertIsNone(child)
コード例 #7
0
ファイル: test_main.py プロジェクト: wel51x/fades
 def test_indicated_with_executable_flag(self):
     analyzable, child = main.decide_child_program(True, "foobar.py")
     self.assertIsNone(analyzable)
     self.assertEqual(child, "foobar.py")
コード例 #8
0
ファイル: test_main.py プロジェクト: xavierxross/fades
 def test_module(self):
     child_path = 'foo.bar'
     analyzable, child = main.decide_child_program(False, True, child_path)
     self.assertIsNone(analyzable)
     self.assertEqual(child, child_path)
コード例 #9
0
ファイル: test_main.py プロジェクト: xavierxross/fades
 def test_indicated_with_executable_flag_with_absolute_path(self):
     """Absolute paths are allowed when using --exec."""
     analyzable, child = main.decide_child_program(True, False,
                                                   "/tmp/foo/bar.py")
     self.assertIsNone(analyzable)
     self.assertEqual(child, "/tmp/foo/bar.py")