Changeset - 98f007b3fd9a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-12-26 15:21:51
mads@kiilerich.com
Grafted from: 9186bf36b145
tests: update test_git_cmd_injection - something with only reproducible with file:, and better error handling raising RepositoryError
1 file changed with 2 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/vcs/test_git.py
Show inline comments
 
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)
 

	
0 comments (0 inline, 0 general)