changeset 8204:98f007b3fd9a

tests: update test_git_cmd_injection - something with only reproducible with file:, and better error handling raising RepositoryError
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 26 Dec 2019 15:21:51 +0100
parents c146a2ab50a8
children 1c64d9bd0599
files kallithea/tests/vcs/test_git.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)