comparison rhodecode/tests/test_hg_operations.py @ 910:811fa5d45de8 beta

Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users. added debug to test hg operations
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 03 Jan 2011 00:47:16 +0100
parents 1f0e37c0854d
children f9016563f987
comparison
equal deleted inserted replaced
909:1f0e37c0854d 910:811fa5d45de8
21 from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO 21 from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO
22 22
23 USER = 'test_admin' 23 USER = 'test_admin'
24 PASS = 'test12' 24 PASS = 'test12'
25 HOST = '127.0.0.1:5000' 25 HOST = '127.0.0.1:5000'
26 26 DEBUG = True
27 log = logging.getLogger(__name__) 27 log = logging.getLogger(__name__)
28 28
29 29
30 class Command(object): 30 class Command(object):
31 31
36 """Runs command on the system with given ``args``. 36 """Runs command on the system with given ``args``.
37 """ 37 """
38 38
39 command = cmd + ' ' + ' '.join(args) 39 command = cmd + ' ' + ' '.join(args)
40 log.debug('Executing %s' % command) 40 log.debug('Executing %s' % command)
41 print command 41 if DEBUG:
42 print command
42 p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd) 43 p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd)
43 stdout, stderr = p.communicate() 44 stdout, stderr = p.communicate()
44 print stdout, stderr 45 if DEBUG:
46 print stdout, stderr
45 return stdout, stderr 47 return stdout, stderr
46 48
47 49
48 #=============================================================================== 50 #==============================================================================
49 # TESTS 51 # TESTS
50 #=============================================================================== 52 #==============================================================================
51 def test_clone(): 53 def test_clone():
52 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) 54 cwd = path = jn(TESTS_TMP_PATH, HG_REPO)
53 55
54 try: 56 try:
55 shutil.rmtree(path, ignore_errors=True) 57 shutil.rmtree(path, ignore_errors=True)
213 assert """abort: HTTP Error 403: Forbidden""" in stderr 215 assert """abort: HTTP Error 403: Forbidden""" in stderr
214 216
215 217
216 if __name__ == '__main__': 218 if __name__ == '__main__':
217 test_clone() 219 test_clone()
218 test_clone_wrong_credentials() 220
221 #test_clone_wrong_credentials()
219 ##test_clone_anonymous_ok() 222 ##test_clone_anonymous_ok()
220 223 test_pull()
221 #test_push_new_file() 224 #test_push_new_file()
222 #test_push_wrong_path() 225 #test_push_wrong_path()
223 #test_push_wrong_credentials() 226 #test_push_wrong_credentials()
224 227
225 228