comparison rhodecode/tests/__init__.py @ 2459:9492ab68331f beta

Initial version of landing revisions ref #483 - fixed relevant tests for creation of repo - added some tests for git
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 14 Jun 2012 23:19:26 +0200
parents 402a96fcfa22
children 7010dc12f10c
comparison
equal deleted inserted replaced
2458:ba49541187d9 2459:9492ab68331f
36 time.tzset() 36 time.tzset()
37 37
38 log = logging.getLogger(__name__) 38 log = logging.getLogger(__name__)
39 39
40 __all__ = [ 40 __all__ = [
41 'environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO', 41 'environ', 'url', 'get_new_dir', 'TestController', 'TESTS_TMP_PATH',
42 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', 42 'HG_REPO', 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK',
43 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_REGULAR_LOGIN', 43 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_REGULAR_LOGIN',
44 'TEST_USER_REGULAR_PASS', 'TEST_USER_REGULAR_EMAIL', 44 'TEST_USER_REGULAR_PASS', 'TEST_USER_REGULAR_EMAIL',
45 'TEST_USER_REGULAR2_LOGIN', 'TEST_USER_REGULAR2_PASS', 45 'TEST_USER_REGULAR2_LOGIN', 'TEST_USER_REGULAR2_PASS',
46 'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO', 'TEST_GIT_REPO', 46 'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO', 'TEST_HG_REPO_CLONE',
47 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', 'SCM_TESTS', 47 'TEST_HG_REPO_PULL', 'TEST_GIT_REPO', 'TEST_GIT_REPO_CLONE',
48 'TEST_GIT_REPO_PULL', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', 'SCM_TESTS',
48 ] 49 ]
49 50
50 # Invoke websetup with the current config file 51 # Invoke websetup with the current config file
51 # SetupCommand('setup-app').run([config_file]) 52 # SetupCommand('setup-app').run([config_file])
52 53
81 82
82 ## VCS 83 ## VCS
83 SCM_TESTS = ['hg', 'git'] 84 SCM_TESTS = ['hg', 'git']
84 uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) 85 uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple())))
85 86
86 THIS = os.path.abspath(os.path.dirname(__file__)) 87 GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
87 88
88 GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
89 TEST_GIT_REPO = jn(TESTS_TMP_PATH, GIT_REPO) 89 TEST_GIT_REPO = jn(TESTS_TMP_PATH, GIT_REPO)
90 TEST_GIT_REPO_CLONE = jn(TESTS_TMP_PATH, 'vcsgitclone%s' % uniq_suffix) 90 TEST_GIT_REPO_CLONE = jn(TESTS_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)
91 TEST_GIT_REPO_PULL = jn(TESTS_TMP_PATH, 'vcsgitpull%s' % uniq_suffix) 91 TEST_GIT_REPO_PULL = jn(TESTS_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)
92 92
93 93
94 HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' 94 HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs'
95 TEST_HG_REPO = jn(TESTS_TMP_PATH, 'vcs-hg') 95
96 TEST_HG_REPO = jn(TESTS_TMP_PATH, HG_REPO)
96 TEST_HG_REPO_CLONE = jn(TESTS_TMP_PATH, 'vcshgclone%s' % uniq_suffix) 97 TEST_HG_REPO_CLONE = jn(TESTS_TMP_PATH, 'vcshgclone%s' % uniq_suffix)
97 TEST_HG_REPO_PULL = jn(TESTS_TMP_PATH, 'vcshgpull%s' % uniq_suffix) 98 TEST_HG_REPO_PULL = jn(TESTS_TMP_PATH, 'vcshgpull%s' % uniq_suffix)
98 99
99 TEST_DIR = tempfile.gettempdir() 100 TEST_DIR = tempfile.gettempdir()
100 TEST_REPO_PREFIX = 'vcs-test' 101 TEST_REPO_PREFIX = 'vcs-test'
102
103 # cached repos if any !
104 # comment out to get some other repos from bb or github
105 GIT_REMOTE_REPO = jn(TESTS_TMP_PATH, GIT_REPO)
106 HG_REMOTE_REPO = jn(TESTS_TMP_PATH, HG_REPO)
101 107
102 108
103 def get_new_dir(title): 109 def get_new_dir(title):
104 """ 110 """
105 Returns always new directory path. 111 Returns always new directory path.
110 name = '-'.join((name, title)) 116 name = '-'.join((name, title))
111 hex = hashlib.sha1(str(time.time())).hexdigest() 117 hex = hashlib.sha1(str(time.time())).hexdigest()
112 name = '-'.join((name, hex)) 118 name = '-'.join((name, hex))
113 path = os.path.join(TEST_DIR, name) 119 path = os.path.join(TEST_DIR, name)
114 return get_normalized_path(path) 120 return get_normalized_path(path)
115
116
117 PACKAGE_DIR = os.path.abspath(os.path.join(
118 os.path.dirname(__file__), '..'))
119
120 TEST_USER_CONFIG_FILE = jn(THIS, 'aconfig')
121 121
122 122
123 class TestController(TestCase): 123 class TestController(TestCase):
124 124
125 def __init__(self, *args, **kwargs): 125 def __init__(self, *args, **kwargs):