Show More
@@ -1,6 +1,7 b'' | |||||
1 | from __future__ import with_statement |
|
1 | from __future__ import with_statement | |
2 |
|
2 | |||
3 | import os |
|
3 | import os | |
|
4 | import sys | |||
4 | import mock |
|
5 | import mock | |
5 | import datetime |
|
6 | import datetime | |
6 | import urllib2 |
|
7 | import urllib2 | |
@@ -39,12 +40,20 b' class GitRepositoryTest(unittest.TestCas' | |||||
39 | clone_fail_repo.clone(repo_inject_path, update_after_clone=True,) |
|
40 | clone_fail_repo.clone(repo_inject_path, update_after_clone=True,) | |
40 |
|
41 | |||
41 | # Verify correct quoting of evil characters that should work on posix file systems |
|
42 | # Verify correct quoting of evil characters that should work on posix file systems | |
42 | tricky_path = get_new_dir("tricky-path-repo-$'\"`") |
|
43 | if sys.platform == 'win32': | |
|
44 | # windows does not allow '"' in dir names | |||
|
45 | tricky_path = get_new_dir("tricky-path-repo-$'`") | |||
|
46 | else: | |||
|
47 | tricky_path = get_new_dir("tricky-path-repo-$'\"`") | |||
43 | successfully_cloned = GitRepository(tricky_path, src_url=TEST_GIT_REPO, update_after_clone=True, create=True) |
|
48 | successfully_cloned = GitRepository(tricky_path, src_url=TEST_GIT_REPO, update_after_clone=True, create=True) | |
44 | # Repo should have been created |
|
49 | # Repo should have been created | |
45 | self.assertFalse(successfully_cloned._repo.bare) |
|
50 | self.assertFalse(successfully_cloned._repo.bare) | |
46 |
|
51 | |||
47 | tricky_path_2 = get_new_dir("tricky-path-2-repo-$'\"`") |
|
52 | if sys.platform == 'win32': | |
|
53 | # windows does not allow '"' in dir names | |||
|
54 | tricky_path_2 = get_new_dir("tricky-path-2-repo-$'`") | |||
|
55 | else: | |||
|
56 | tricky_path_2 = get_new_dir("tricky-path-2-repo-$'\"`") | |||
48 | successfully_cloned2 = GitRepository(tricky_path_2, src_url=tricky_path, bare=True, create=True) |
|
57 | successfully_cloned2 = GitRepository(tricky_path_2, src_url=tricky_path, bare=True, create=True) | |
49 | # Repo should have been created and thus used correct quoting for clone |
|
58 | # Repo should have been created and thus used correct quoting for clone | |
50 | self.assertTrue(successfully_cloned2._repo.bare) |
|
59 | self.assertTrue(successfully_cloned2._repo.bare) | |
@@ -53,6 +62,12 b' class GitRepositoryTest(unittest.TestCas' | |||||
53 | successfully_cloned.pull(tricky_path_2) |
|
62 | successfully_cloned.pull(tricky_path_2) | |
54 | successfully_cloned2.fetch(tricky_path) |
|
63 | successfully_cloned2.fetch(tricky_path) | |
55 |
|
64 | |||
|
65 | def test_repo_create_with_spaces_in_path(self): | |||
|
66 | repo_path = get_new_dir("path with spaces") | |||
|
67 | repo = GitRepository(repo_path, src_url=None, bare=True, create=True) | |||
|
68 | # Repo should have been created | |||
|
69 | self.assertTrue(repo._repo.bare) | |||
|
70 | ||||
56 | def test_repo_clone(self): |
|
71 | def test_repo_clone(self): | |
57 | self.__check_for_existing_repo() |
|
72 | self.__check_for_existing_repo() | |
58 | repo = GitRepository(TEST_GIT_REPO) |
|
73 | repo = GitRepository(TEST_GIT_REPO) | |
@@ -64,6 +79,15 b' class GitRepositoryTest(unittest.TestCas' | |||||
64 | raw_id = changeset.raw_id |
|
79 | raw_id = changeset.raw_id | |
65 | self.assertEqual(raw_id, repo_clone.get_changeset(raw_id).raw_id) |
|
80 | self.assertEqual(raw_id, repo_clone.get_changeset(raw_id).raw_id) | |
66 |
|
81 | |||
|
82 | def test_repo_clone_with_spaces_in_path(self): | |||
|
83 | repo_path = get_new_dir("path with spaces") | |||
|
84 | successfully_cloned = GitRepository(repo_path, src_url=TEST_GIT_REPO, update_after_clone=True, create=True) | |||
|
85 | # Repo should have been created | |||
|
86 | self.assertFalse(successfully_cloned._repo.bare) | |||
|
87 | ||||
|
88 | successfully_cloned.pull(TEST_GIT_REPO) | |||
|
89 | self.repo.fetch(repo_path) | |||
|
90 | ||||
67 | def test_repo_clone_without_create(self): |
|
91 | def test_repo_clone_without_create(self): | |
68 | self.assertRaises(RepositoryError, GitRepository, |
|
92 | self.assertRaises(RepositoryError, GitRepository, | |
69 | TEST_GIT_REPO_CLONE + '_wo_create', src_url=TEST_GIT_REPO) |
|
93 | TEST_GIT_REPO_CLONE + '_wo_create', src_url=TEST_GIT_REPO) |
General Comments 0
You need to be logged in to leave comments.
Login now