Show More
@@ -54,6 +54,7 b' add_cache(conf)' | |||
|
54 | 54 | USER = 'test_admin' |
|
55 | 55 | PASS = 'test12' |
|
56 | 56 | HOST = '127.0.0.1:5000' |
|
57 | METHOD = 'pull' | |
|
57 | 58 | DEBUG = True |
|
58 | 59 | log = logging.getLogger(__name__) |
|
59 | 60 | |
@@ -153,9 +154,12 b' def get_anonymous_access():' | |||
|
153 | 154 | #============================================================================== |
|
154 | 155 | # TESTS |
|
155 | 156 | #============================================================================== |
|
156 |
def test_clone_with_credentials(no_errors=False, repo=HG_REPO |
|
|
157 | def test_clone_with_credentials(no_errors=False, repo=HG_REPO, method=METHOD, | |
|
158 | seq=None): | |
|
157 | 159 | cwd = path = jn(TESTS_TMP_PATH, repo) |
|
158 | 160 | |
|
161 | if seq == None: | |
|
162 | seq = _RandomNameSequence().next() | |
|
159 | 163 | |
|
160 | 164 | try: |
|
161 | 165 | shutil.rmtree(path, ignore_errors=True) |
@@ -165,14 +169,17 b' def test_clone_with_credentials(no_error' | |||
|
165 | 169 | raise |
|
166 | 170 | |
|
167 | 171 | |
|
168 |
clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s |
|
|
172 | clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \ | |
|
169 | 173 | {'user':USER, |
|
170 | 174 | 'pass':PASS, |
|
171 | 175 | 'host':HOST, |
|
172 | 'cloned_repo':repo, | |
|
173 | 'dest':path + _RandomNameSequence().next()} | |
|
176 | 'cloned_repo':repo, } | |
|
174 | 177 | |
|
175 | stdout, stderr = Command(cwd).execute('hg clone', clone_url) | |
|
178 | dest = path + seq | |
|
179 | if method == 'pull': | |
|
180 | stdout, stderr = Command(cwd).execute('hg', method, '--cwd', dest, clone_url) | |
|
181 | else: | |
|
182 | stdout, stderr = Command(cwd).execute('hg', method, clone_url, dest) | |
|
176 | 183 | |
|
177 | 184 | if no_errors is False: |
|
178 | 185 | assert """adding file changes""" in stdout, 'no messages about cloning' |
@@ -181,9 +188,19 b' def test_clone_with_credentials(no_error' | |||
|
181 | 188 | if __name__ == '__main__': |
|
182 | 189 | try: |
|
183 | 190 | create_test_user(force=False) |
|
191 | seq = None | |
|
192 | import time | |
|
184 | 193 | |
|
194 | if METHOD == 'pull': | |
|
195 | seq = _RandomNameSequence().next() | |
|
196 | test_clone_with_credentials(repo=sys.argv[1], method='clone', | |
|
197 | seq=seq) | |
|
198 | s = time.time() | |
|
185 | 199 | for i in range(int(sys.argv[2])): |
|
186 | test_clone_with_credentials(repo=sys.argv[1]) | |
|
187 | ||
|
200 | print 'take', i | |
|
201 | test_clone_with_credentials(repo=sys.argv[1], method=METHOD, | |
|
202 | seq=seq) | |
|
203 | print 'time taken %.3f' % (time.time() - s) | |
|
188 | 204 | except Exception, e: |
|
205 | raise | |
|
189 | 206 | sys.exit('stop on %s' % e) |
General Comments 0
You need to be logged in to leave comments.
Login now