# HG changeset patch # User Mads Kiilerich # Date 2019-12-26 15:21:51 # Node ID 98f007b3fd9a70f07fcbedd581bacde48fbb3275 # Parent c146a2ab50a85eb73d18bb9b0e8705b9bc6e8e0b tests: update test_git_cmd_injection - something with only reproducible with file:, and better error handling raising RepositoryError diff --git a/kallithea/tests/vcs/test_git.py b/kallithea/tests/vcs/test_git.py --- a/kallithea/tests/vcs/test_git.py +++ b/kallithea/tests/vcs/test_git.py @@ -1,7 +1,6 @@ import datetime import os import sys -import urllib.error import mock import pytest @@ -31,8 +30,8 @@ class TestGitRepository(object): GitRepository(wrong_repo_path) def test_git_cmd_injection(self): - repo_inject_path = TEST_GIT_REPO + '; echo "Cake";' - with pytest.raises(urllib.error.URLError): + repo_inject_path = 'file:/%s; echo "Cake";' % TEST_GIT_REPO + with pytest.raises(RepositoryError): # Should fail because URL will contain the parts after ; too GitRepository(get_new_dir('injection-repo'), src_url=repo_inject_path, update_after_clone=True, create=True)