Show More
@@ -46,15 +46,15 b' from rhodecode.lib.auth import get_crypt' | |||
|
46 | 46 | from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO |
|
47 | 47 | from rhodecode.config.environment import load_environment |
|
48 | 48 | |
|
49 | rel_path = dn(dn(dn(os.path.abspath(__file__)))) | |
|
50 |
conf = appconfig('config: |
|
|
49 | rel_path = dn(dn(dn(dn(os.path.abspath(__file__))))) | |
|
50 | conf = appconfig('config:rc.ini', relative_to=rel_path) | |
|
51 | 51 | load_environment(conf.global_conf, conf.local_conf) |
|
52 | 52 | |
|
53 | 53 | add_cache(conf) |
|
54 | 54 | |
|
55 | 55 | USER = 'test_admin' |
|
56 | 56 | PASS = 'test12' |
|
57 |
HOST = ' |
|
|
57 | HOST = 'rc.local' | |
|
58 | 58 | METHOD = 'pull' |
|
59 | 59 | DEBUG = True |
|
60 | 60 | log = logging.getLogger(__name__) |
@@ -130,10 +130,10 b' def create_test_repo(force=True):' | |||
|
130 | 130 | if repo is None: |
|
131 | 131 | print 'repo not found creating' |
|
132 | 132 | |
|
133 | form_data = {'repo_name':HG_REPO, | |
|
134 | 'repo_type':'hg', | |
|
133 | form_data = {'repo_name': HG_REPO, | |
|
134 | 'repo_type': 'hg', | |
|
135 | 135 | 'private':False, |
|
136 | 'clone_uri':'' } | |
|
136 | 'clone_uri': '' } | |
|
137 | 137 | rm = RepoModel(sa) |
|
138 | 138 | rm.base_path = '/home/hg' |
|
139 | 139 | rm.create(form_data, user) |
@@ -158,7 +158,7 b' def get_anonymous_access():' | |||
|
158 | 158 | # TESTS |
|
159 | 159 | #============================================================================== |
|
160 | 160 | def test_clone_with_credentials(no_errors=False, repo=HG_REPO, method=METHOD, |
|
161 | seq=None): | |
|
161 | seq=None, backend='hg'): | |
|
162 | 162 | cwd = path = jn(TESTS_TMP_PATH, repo) |
|
163 | 163 | |
|
164 | 164 | if seq == None: |
@@ -172,20 +172,23 b' def test_clone_with_credentials(no_error' | |||
|
172 | 172 | raise |
|
173 | 173 | |
|
174 | 174 | clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \ |
|
175 | {'user':USER, | |
|
176 | 'pass':PASS, | |
|
177 | 'host':HOST, | |
|
178 | 'cloned_repo':repo, } | |
|
175 | {'user': USER, | |
|
176 | 'pass': PASS, | |
|
177 | 'host': HOST, | |
|
178 | 'cloned_repo': repo, } | |
|
179 | 179 | |
|
180 | 180 | dest = path + seq |
|
181 | 181 | if method == 'pull': |
|
182 |
stdout, stderr = Command(cwd).execute( |
|
|
182 | stdout, stderr = Command(cwd).execute(backend, method, '--cwd', dest, clone_url) | |
|
183 | 183 | else: |
|
184 |
stdout, stderr = Command(cwd).execute( |
|
|
185 | ||
|
184 | stdout, stderr = Command(cwd).execute(backend, method, clone_url, dest) | |
|
185 | print stdout,'sdasdsadsa' | |
|
186 | 186 | if no_errors is False: |
|
187 | assert """adding file changes""" in stdout, 'no messages about cloning' | |
|
188 | assert """abort""" not in stderr , 'got error from clone' | |
|
187 | if backend == 'hg': | |
|
188 | assert """adding file changes""" in stdout, 'no messages about cloning' | |
|
189 | assert """abort""" not in stderr , 'got error from clone' | |
|
190 | elif backend == 'git': | |
|
191 | assert """Cloning into""" in stdout, 'no messages about cloning' | |
|
189 | 192 | |
|
190 | 193 | if __name__ == '__main__': |
|
191 | 194 | try: |
@@ -198,15 +201,20 b" if __name__ == '__main__':" | |||
|
198 | 201 | except: |
|
199 | 202 | pass |
|
200 | 203 | |
|
204 | try: | |
|
205 | backend = sys.argv[4] | |
|
206 | except: | |
|
207 | backend = 'hg' | |
|
208 | ||
|
201 | 209 | if METHOD == 'pull': |
|
202 | 210 | seq = _RandomNameSequence().next() |
|
203 | 211 | test_clone_with_credentials(repo=sys.argv[1], method='clone', |
|
204 | seq=seq) | |
|
212 | seq=seq, backend=backend) | |
|
205 | 213 | s = time.time() |
|
206 | 214 | for i in range(1, int(sys.argv[2]) + 1): |
|
207 | 215 | print 'take', i |
|
208 | 216 | test_clone_with_credentials(repo=sys.argv[1], method=METHOD, |
|
209 | seq=seq) | |
|
217 | seq=seq, backend=backend) | |
|
210 | 218 | print 'time taken %.3f' % (time.time() - s) |
|
211 | 219 | except Exception, e: |
|
212 | 220 | raise |
General Comments 0
You need to be logged in to leave comments.
Login now