Show More
@@ -4,9 +4,10 | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Test suite for making push/pull operations. |
|
6 | Test suite for making push/pull operations. | |
7 | Run using:: |
|
7 | Run using after doing paster serve test.ini:: | |
|
8 | RC_WHOOSH_TEST_DISABLE=1 RC_NO_TMP_PATH=1 nosetests rhodecode/tests/scripts/test_vcs_operations.py | |||
8 |
|
9 | |||
9 | RC_WHOOSH_TEST_DISABLE=1 RC_NO_TMP_PATH=1 nosetests rhodecode/tests/scripts/test_vcs_operations.py |
|
10 | You must have git > 1.8.1 for tests to work fine | |
10 |
|
11 | |||
11 | :created_on: Dec 30, 2010 |
|
12 | :created_on: Dec 30, 2010 | |
12 | :author: marcink |
|
13 | :author: marcink | |
@@ -107,13 +108,14 def _add_files_and_push(vcs, DEST, **kwa | |||||
107 | for i in xrange(3): |
|
108 | for i in xrange(3): | |
108 | cmd = """echo 'added_line%s' >> %s""" % (i, added_file) |
|
109 | cmd = """echo 'added_line%s' >> %s""" % (i, added_file) | |
109 | Command(cwd).execute(cmd) |
|
110 | Command(cwd).execute(cmd) | |
|
111 | author_str = 'Marcin KuΕΊminski <me@email.com>' | |||
110 | if vcs == 'hg': |
|
112 | if vcs == 'hg': | |
111 | cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % ( |
|
113 | cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % ( | |
112 |
i, |
|
114 | i, author_str, added_file | |
113 | ) |
|
115 | ) | |
114 | elif vcs == 'git': |
|
116 | elif vcs == 'git': | |
115 | cmd = """git commit -m 'commited new %s' --author '%s' %s """ % ( |
|
117 | cmd = """git commit -m 'commited new %s' --author '%s' %s """ % ( | |
116 |
i, |
|
118 | i, author_str, added_file | |
117 | ) |
|
119 | ) | |
118 | Command(cwd).execute(cmd) |
|
120 | Command(cwd).execute(cmd) | |
119 | # PUSH it back |
|
121 | # PUSH it back | |
@@ -129,7 +131,7 def _add_files_and_push(vcs, DEST, **kwa | |||||
129 | if vcs == 'hg': |
|
131 | if vcs == 'hg': | |
130 | stdout, stderr = Command(cwd).execute('hg push --verbose', clone_url) |
|
132 | stdout, stderr = Command(cwd).execute('hg push --verbose', clone_url) | |
131 | elif vcs == 'git': |
|
133 | elif vcs == 'git': | |
132 | stdout, stderr = Command(cwd).execute('git push', clone_url + " master") |
|
134 | stdout, stderr = Command(cwd).execute('git push --verbose', clone_url + " master") | |
133 |
|
135 | |||
134 | return stdout, stderr |
|
136 | return stdout, stderr | |
135 |
|
137 | |||
@@ -324,8 +326,7 class TestVCSOperations(unittest.TestCas | |||||
324 | #pull fails since repo is locked |
|
326 | #pull fails since repo is locked | |
325 | clone_url = _construct_url(GIT_REPO) |
|
327 | clone_url = _construct_url(GIT_REPO) | |
326 | stdout, stderr = Command('/tmp').execute('git clone', clone_url) |
|
328 | stdout, stderr = Command('/tmp').execute('git clone', clone_url) | |
327 | msg = ("""423 Repository `%s` locked by user `%s`""" |
|
329 | msg = ("""The requested URL returned error: 423""") | |
328 | % (GIT_REPO, TEST_USER_ADMIN_LOGIN)) |
|
|||
329 | assert msg in stderr |
|
330 | assert msg in stderr | |
330 |
|
331 | |||
331 | def test_push_on_locked_repo_by_other_user_hg(self): |
|
332 | def test_push_on_locked_repo_by_other_user_hg(self): | |
@@ -455,7 +456,8 class TestVCSOperations(unittest.TestCas | |||||
455 | Session().commit() |
|
456 | Session().commit() | |
456 | clone_url = _construct_url(GIT_REPO) |
|
457 | clone_url = _construct_url(GIT_REPO) | |
457 | stdout, stderr = Command('/tmp').execute('git clone', clone_url) |
|
458 | stdout, stderr = Command('/tmp').execute('git clone', clone_url) | |
458 |
|
|
459 | msg = ("""The requested URL returned error: 403""") | |
|
460 | assert msg in stderr | |||
459 | finally: |
|
461 | finally: | |
460 | #release IP restrictions |
|
462 | #release IP restrictions | |
461 | for ip in UserIpMap.getAll(): |
|
463 | for ip in UserIpMap.getAll(): |
General Comments 0
You need to be logged in to leave comments.
Login now