Mercurial > kallithea
annotate rhodecode/tests/test_hg_operations.py @ 1277:cf2a67b91ffc beta
fixed path for .ini file in test hg operations
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 23 Apr 2011 15:56:17 +0200 |
parents | 6832ef664673 |
children | 1bd6ed0f38b1 |
rev | line source |
---|---|
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
1 # -*- coding: utf-8 -*- |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
2 """ |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
3 rhodecode.tests.test_hg_operations |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
5 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
6 Test suite for making push/pull operations |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
7 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
8 :created_on: Dec 30, 2010 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
9 :copyright: (c) 2010 by marcink. |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
10 :license: LICENSE_NAME, see LICENSE_FILE for more details. |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
11 """ |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
12 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
13 import os |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
14 import shutil |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
15 import logging |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
16 from os.path import join as jn |
1277
cf2a67b91ffc
fixed path for .ini file in test hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
17 from os.path import dirname as dn |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
18 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
19 from tempfile import _RandomNameSequence |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
20 from subprocess import Popen, PIPE |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
21 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
22 from paste.deploy import appconfig |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
23 from pylons import config |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
24 from sqlalchemy import engine_from_config |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
25 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
26 from rhodecode.lib.utils import add_cache |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
27 from rhodecode.model import init_model |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
28 from rhodecode.model import meta |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
29 from rhodecode.model.db import User, Repository |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
30 from rhodecode.lib.auth import get_crypt_password |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
31 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
32 from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
33 from rhodecode.config.environment import load_environment |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
34 |
1277
cf2a67b91ffc
fixed path for .ini file in test hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
35 rel_path = dn(dn(dn(os.path.abspath(__file__)))) |
cf2a67b91ffc
fixed path for .ini file in test hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
36 conf = appconfig('config:development.ini', relative_to=rel_path) |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
37 load_environment(conf.global_conf, conf.local_conf) |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
38 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
39 add_cache(conf) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
40 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
41 USER = 'test_admin' |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
42 PASS = 'test12' |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
43 HOST = '127.0.0.1:5000' |
910
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
44 DEBUG = True |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
45 log = logging.getLogger(__name__) |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
46 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
47 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
48 class Command(object): |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
49 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
50 def __init__(self, cwd): |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
51 self.cwd = cwd |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
52 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
53 def execute(self, cmd, *args): |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
54 """Runs command on the system with given ``args``. |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
55 """ |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
56 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
57 command = cmd + ' ' + ' '.join(args) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
58 log.debug('Executing %s' % command) |
910
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
59 if DEBUG: |
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
60 print command |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
61 p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
62 stdout, stderr = p.communicate() |
910
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
63 if DEBUG: |
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
64 print stdout, stderr |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
65 return stdout, stderr |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
66 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
67 def get_session(): |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
68 engine = engine_from_config(conf, 'sqlalchemy.db1.') |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
69 init_model(engine) |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
70 sa = meta.Session() |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
71 return sa |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
72 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
73 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
74 def create_test_user(force=True): |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
75 print 'creating test user' |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
76 sa = get_session() |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
77 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
78 user = sa.query(User).filter(User.username == USER).scalar() |
988
7f4943c90876
fixed test hg operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
930
diff
changeset
|
79 |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
80 if force and user is not None: |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
81 print 'removing current user' |
1047 | 82 for repo in sa.query(Repository).filter(Repository.user == user).all(): |
83 sa.delete(repo) | |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
84 sa.delete(user) |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
85 sa.commit() |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
86 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
87 if user is None or force: |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
88 print 'creating new one' |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
89 new_usr = User() |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
90 new_usr.username = USER |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
91 new_usr.password = get_crypt_password(PASS) |
988
7f4943c90876
fixed test hg operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
930
diff
changeset
|
92 new_usr.email = 'mail@mail.com' |
7f4943c90876
fixed test hg operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
930
diff
changeset
|
93 new_usr.name = 'test' |
7f4943c90876
fixed test hg operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
930
diff
changeset
|
94 new_usr.lastname = 'lasttestname' |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
95 new_usr.active = True |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
96 new_usr.admin = True |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
97 sa.add(new_usr) |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
98 sa.commit() |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
99 |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
100 print 'done' |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
101 |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
102 |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
103 def create_test_repo(force=True): |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
104 from rhodecode.model.repo import RepoModel |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
105 sa = get_session() |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
106 |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
107 user = sa.query(User).filter(User.username == USER).scalar() |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
108 if user is None: |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
109 raise Exception('user not found') |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
110 |
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
111 |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
112 repo = sa.query(Repository).filter(Repository.repo_name == HG_REPO).scalar() |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
113 |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
114 if repo is None: |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
115 print 'repo not found creating' |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
116 |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
117 form_data = {'repo_name':HG_REPO, |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
118 'repo_type':'hg', |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
119 'private':False, } |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
120 rm = RepoModel(sa) |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
121 rm.base_path = '/home/hg' |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
122 rm.create(form_data, user) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
123 |
1047 | 124 |
125 def set_anonymous_access(enable=True): | |
126 sa = get_session() | |
127 user = sa.query(User).filter(User.username == 'default').one() | |
128 user.active = enable | |
129 sa.add(user) | |
130 sa.commit() | |
131 | |
132 def get_anonymous_access(): | |
133 sa = get_session() | |
134 return sa.query(User).filter(User.username == 'default').one().active | |
135 | |
136 | |
910
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
137 #============================================================================== |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
138 # TESTS |
910
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
139 #============================================================================== |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
140 def test_clone(no_errors=False): |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
141 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
142 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
143 try: |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
144 shutil.rmtree(path, ignore_errors=True) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
145 os.makedirs(path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
146 #print 'made dirs %s' % jn(path) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
147 except OSError: |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
148 raise |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
149 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
150 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
151 clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s %(dest)s' % \ |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
152 {'user':USER, |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
153 'pass':PASS, |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
154 'host':HOST, |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
155 'cloned_repo':HG_REPO, |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
156 'dest':path} |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
157 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
158 stdout, stderr = Command(cwd).execute('hg clone', clone_url) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
159 |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
160 if no_errors is False: |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
161 assert """adding file changes""" in stdout, 'no messages about cloning' |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
162 assert """abort""" not in stderr , 'got error from clone' |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
163 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
164 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
165 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
166 def test_clone_anonymous_ok(): |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
167 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
168 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
169 try: |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
170 shutil.rmtree(path, ignore_errors=True) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
171 os.makedirs(path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
172 #print 'made dirs %s' % jn(path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
173 except OSError: |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
174 raise |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
175 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
176 |
1047 | 177 print 'checking if anonymous access is enabled' |
178 anonymous_access = get_anonymous_access() | |
179 if not anonymous_access: | |
180 print 'not enabled, enabling it ' | |
181 set_anonymous_access(enable=True) | |
182 | |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
183 clone_url = 'http://%(host)s/%(cloned_repo)s %(dest)s' % \ |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
184 {'user':USER, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
185 'pass':PASS, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
186 'host':HOST, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
187 'cloned_repo':HG_REPO, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
188 'dest':path} |
755
99ece4c484e1
Added basic test push/pull script
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
189 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
190 stdout, stderr = Command(cwd).execute('hg clone', clone_url) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
191 print stdout, stderr |
1047 | 192 |
193 | |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
194 assert """adding file changes""" in stdout, 'no messages about cloning' |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
195 assert """abort""" not in stderr , 'got error from clone' |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
196 |
1047 | 197 #disable if it was enabled |
198 if not anonymous_access: | |
199 print 'disabling anonymous access' | |
200 set_anonymous_access(enable=False) | |
201 | |
202 | |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
203 def test_clone_wrong_credentials(): |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
204 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
205 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
206 try: |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
207 shutil.rmtree(path, ignore_errors=True) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
208 os.makedirs(path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
209 #print 'made dirs %s' % jn(path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
210 except OSError: |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
211 raise |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
212 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
213 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
214 clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s %(dest)s' % \ |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
215 {'user':USER + 'error', |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
216 'pass':PASS, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
217 'host':HOST, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
218 'cloned_repo':HG_REPO, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
219 'dest':path} |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
220 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
221 stdout, stderr = Command(cwd).execute('hg clone', clone_url) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
222 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
223 assert """abort: authorization failed""" in stderr , 'no error from wrong credentials' |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
224 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
225 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
226 def test_pull(): |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
227 pass |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
228 |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
229 def test_push_modify_file(f_name='setup.py'): |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
230 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
231 modified_file = jn(TESTS_TMP_PATH, HG_REPO, f_name) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
232 for i in xrange(5): |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
233 cmd = """echo 'added_line%s' >> %s""" % (i, modified_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
234 Command(cwd).execute(cmd) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
235 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
236 cmd = """hg ci -m 'changed file %s' %s """ % (i, modified_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
237 Command(cwd).execute(cmd) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
238 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
239 Command(cwd).execute('hg push %s' % jn(TESTS_TMP_PATH, HG_REPO)) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
240 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
241 def test_push_new_file(commits=15): |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
242 |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
243 test_clone(no_errors=True) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
244 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
245 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
246 added_file = jn(path, '%ssetupążźć.py' % _RandomNameSequence().next()) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
247 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
248 Command(cwd).execute('touch %s' % added_file) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
249 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
250 Command(cwd).execute('hg add %s' % added_file) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
251 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
252 for i in xrange(commits): |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
253 cmd = """echo 'added_line%s' >> %s""" % (i, added_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
254 Command(cwd).execute(cmd) |
809
7b18e7ca66da
extended hg push test script
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
255 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
256 cmd = """hg ci -m 'commited new %s' %s """ % (i, added_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
257 Command(cwd).execute(cmd) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
258 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
259 push_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \ |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
260 {'user':USER, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
261 'pass':PASS, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
262 'host':HOST, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
263 'cloned_repo':HG_REPO, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
264 'dest':jn(TESTS_TMP_PATH, HG_REPO)} |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
265 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
266 Command(cwd).execute('hg push --verbose --debug %s' % push_url) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
267 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
268 def test_push_wrong_credentials(): |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
269 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
270 clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \ |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
271 {'user':USER + 'xxx', |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
272 'pass':PASS, |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
273 'host':HOST, |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
274 'cloned_repo':HG_REPO, |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
275 'dest':jn(TESTS_TMP_PATH, HG_REPO)} |
809
7b18e7ca66da
extended hg push test script
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
276 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
277 modified_file = jn(TESTS_TMP_PATH, HG_REPO, 'setup.py') |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
278 for i in xrange(5): |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
279 cmd = """echo 'added_line%s' >> %s""" % (i, modified_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
280 Command(cwd).execute(cmd) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
281 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
282 cmd = """hg ci -m 'commited %s' %s """ % (i, modified_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
283 Command(cwd).execute(cmd) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
284 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
285 Command(cwd).execute('hg push %s' % clone_url) |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
286 |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
287 def test_push_wrong_path(): |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
288 cwd = path = jn(TESTS_TMP_PATH, HG_REPO) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
289 added_file = jn(path, 'somefile.py') |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
290 |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
291 try: |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
292 shutil.rmtree(path, ignore_errors=True) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
293 os.makedirs(path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
294 print 'made dirs %s' % jn(path) |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
295 except OSError: |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
296 raise |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
297 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
298 Command(cwd).execute("""echo '' > %s""" % added_file) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
299 Command(cwd).execute("""hg init %s""" % path) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
300 Command(cwd).execute("""hg add %s""" % added_file) |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
301 |
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
302 for i in xrange(2): |
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
303 cmd = """echo 'added_line%s' >> %s""" % (i, added_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
304 Command(cwd).execute(cmd) |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
305 |
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
306 cmd = """hg ci -m 'commited new %s' %s """ % (i, added_file) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
307 Command(cwd).execute(cmd) |
897
a7efcee0f399
updated mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
896
diff
changeset
|
308 |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
309 clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \ |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
310 {'user':USER, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
311 'pass':PASS, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
312 'host':HOST, |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
313 'cloned_repo':HG_REPO + '_error', |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
314 'dest':jn(TESTS_TMP_PATH, HG_REPO)} |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
315 |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
316 stdout, stderr = Command(cwd).execute('hg push %s' % clone_url) |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
317 assert """abort: HTTP Error 403: Forbidden""" in stderr |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
318 |
896
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
319 |
af65ca7e5c2b
changed mercurial test operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
809
diff
changeset
|
320 if __name__ == '__main__': |
1008
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
321 create_test_user(force=False) |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
322 create_test_repo() |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
323 #test_push_modify_file() |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
324 #test_clone() |
a9421a8a874f
updated testing script for hg operations
Marcin Kuzminski <marcin@python-works.com>
parents:
988
diff
changeset
|
325 #test_clone_anonymous_ok() |
910
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
326 |
811fa5d45de8
Rewrite simehg for enabling cloning with raw url for anonymous access + some optimizations for making less queries when authenticating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
909
diff
changeset
|
327 #test_clone_wrong_credentials() |
988
7f4943c90876
fixed test hg operations script
Marcin Kuzminski <marcin@python-works.com>
parents:
930
diff
changeset
|
328 |
930
f9016563f987
Added sql session into test hg script
Marcin Kuzminski <marcin@python-works.com>
parents:
910
diff
changeset
|
329 #test_pull() |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
330 test_push_new_file(commits=15) |
909
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
331 #test_push_wrong_path() |
1f0e37c0854d
fixed hg operations test script
Marcin Kuzminski <marcin@python-works.com>
parents:
897
diff
changeset
|
332 #test_push_wrong_credentials() |