# HG changeset patch # User Mads Kiilerich # Date 1577370111 -3600 # Node ID 98f007b3fd9a70f07fcbedd581bacde48fbb3275 # Parent c146a2ab50a85eb73d18bb9b0e8705b9bc6e8e0b tests: update test_git_cmd_injection - something with only reproducible with file:, and better error handling raising RepositoryError diff -r c146a2ab50a8 -r 98f007b3fd9a kallithea/tests/vcs/test_git.py --- a/kallithea/tests/vcs/test_git.py Thu Dec 26 11:27:11 2019 +0100 +++ b/kallithea/tests/vcs/test_git.py Thu Dec 26 15:21:51 2019 +0100 @@ -1,7 +1,6 @@ import datetime import os import sys -import urllib.error import mock import pytest @@ -31,8 +30,8 @@ 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)