Show More
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -70,6 +70,7 b' class ReposController(BaseController):' | |||
|
70 | 70 | repo_model = RepoModel() |
|
71 | 71 | c.users_array = repo_model.get_users_js() |
|
72 | 72 | c.users_groups_array = repo_model.get_users_groups_js() |
|
73 | c.landing_revs = ScmModel().get_repo_landing_revs() | |
|
73 | 74 | |
|
74 | 75 | def __load_data(self, repo_name=None): |
|
75 | 76 | """ |
@@ -91,6 +92,7 b' class ReposController(BaseController):' | |||
|
91 | 92 | |
|
92 | 93 | return redirect(url('repos')) |
|
93 | 94 | |
|
95 | c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info) | |
|
94 | 96 | c.default_user_id = User.get_by_username('default').user_id |
|
95 | 97 | c.in_public_journal = UserFollowing.query()\ |
|
96 | 98 | .filter(UserFollowing.user_id == c.default_user_id)\ |
@@ -116,6 +118,7 b' class ReposController(BaseController):' | |||
|
116 | 118 | c.repos_list = [('', _('--REMOVE FORK--'))] |
|
117 | 119 | c.repos_list += [(x.repo_id, x.repo_name) for x in |
|
118 | 120 | Repository.query().order_by(Repository.repo_name).all()] |
|
121 | ||
|
119 | 122 | return defaults |
|
120 | 123 | |
|
121 | 124 | @HasPermissionAllDecorator('hg.admin') |
@@ -397,6 +397,7 b' class SettingsController(BaseController)' | |||
|
397 | 397 | |
|
398 | 398 | c.repo_groups = RepoGroup.groups_choices() |
|
399 | 399 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) |
|
400 | c.landing_revs = ScmModel().get_repo_landing_revs() | |
|
400 | 401 | |
|
401 | 402 | new_repo = request.GET.get('repo', '') |
|
402 | 403 | c.new_repo = repo_name_slug(new_repo) |
@@ -448,7 +448,8 b' def repo2db_mapper(initial_repo_list, re' | |||
|
448 | 448 | 'description': repo.description \ |
|
449 | 449 | if repo.description != 'unknown' else '%s repository' % name, |
|
450 | 450 | 'private': False, |
|
451 | 'group_id': getattr(group, 'group_id', None) | |
|
451 | 'group_id': getattr(group, 'group_id', None), | |
|
452 | 'landing_rev': repo.DEFAULT_BRANCH_NAME | |
|
452 | 453 | } |
|
453 | 454 | rm.create(form_data, user, just_db=True) |
|
454 | 455 | sa.commit() |
@@ -558,7 +559,7 b' def create_test_env(repos_test_path, con' | |||
|
558 | 559 | install test repository into tmp dir |
|
559 | 560 | """ |
|
560 | 561 | from rhodecode.lib.db_manage import DbManage |
|
561 | from rhodecode.tests import HG_REPO, TESTS_TMP_PATH | |
|
562 | from rhodecode.tests import HG_REPO, GIT_REPO, TESTS_TMP_PATH | |
|
562 | 563 | |
|
563 | 564 | # PART ONE create db |
|
564 | 565 | dbconf = config['sqlalchemy.db1.url'] |
@@ -593,12 +594,17 b' def create_test_env(repos_test_path, con' | |||
|
593 | 594 | log.debug('remove %s' % data_path) |
|
594 | 595 | shutil.rmtree(data_path) |
|
595 | 596 | |
|
596 |
#CREATE DEFAULT |
|
|
597 | #CREATE DEFAULT TEST REPOS | |
|
597 | 598 | cur_dir = dn(dn(abspath(__file__))) |
|
598 | 599 | tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test_hg.tar.gz")) |
|
599 | 600 | tar.extractall(jn(TESTS_TMP_PATH, HG_REPO)) |
|
600 | 601 | tar.close() |
|
601 | 602 | |
|
603 | cur_dir = dn(dn(abspath(__file__))) | |
|
604 | tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test_git.tar.gz")) | |
|
605 | tar.extractall(jn(TESTS_TMP_PATH, GIT_REPO)) | |
|
606 | tar.close() | |
|
607 | ||
|
602 | 608 | #LOAD VCS test stuff |
|
603 | 609 | from rhodecode.tests.vcs import setup_package |
|
604 | 610 | setup_package() |
@@ -295,7 +295,7 b' class User(Base, BaseModel):' | |||
|
295 | 295 | password = Column("password", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
296 | 296 | active = Column("active", Boolean(), nullable=True, unique=None, default=None) |
|
297 | 297 | admin = Column("admin", Boolean(), nullable=True, unique=None, default=False) |
|
298 | name = Column("name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
|
298 | name = Column("firstname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
|
299 | 299 | lastname = Column("lastname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
300 | 300 | _email = Column("email", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
301 | 301 | last_login = Column("last_login", DateTime(timezone=False), nullable=True, unique=None, default=None) |
@@ -500,13 +500,14 b' class Repository(Base, BaseModel):' | |||
|
500 | 500 | repo_id = Column("repo_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
501 | 501 | repo_name = Column("repo_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) |
|
502 | 502 | clone_uri = Column("clone_uri", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=False, default=None) |
|
503 |
repo_type = Column("repo_type", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default= |
|
|
503 | repo_type = Column("repo_type", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default=None) | |
|
504 | 504 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None) |
|
505 | 505 | private = Column("private", Boolean(), nullable=True, unique=None, default=None) |
|
506 | 506 | enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True) |
|
507 | 507 | enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True) |
|
508 | 508 | description = Column("description", String(length=10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
509 | 509 | created_on = Column('created_on', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now) |
|
510 | landing_rev = Column("landing_revision", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default=None) | |
|
510 | 511 | |
|
511 | 512 | fork_id = Column("fork_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=False, default=None) |
|
512 | 513 | group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=False, default=None) |
@@ -523,7 +524,7 b' class Repository(Base, BaseModel):' | |||
|
523 | 524 | logs = relationship('UserLog') |
|
524 | 525 | |
|
525 | 526 | def __unicode__(self): |
|
526 | return u"<%s('%s:%s')>" % (self.__class__.__name__,self.repo_id, | |
|
527 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, | |
|
527 | 528 | self.repo_name) |
|
528 | 529 | |
|
529 | 530 | @classmethod |
@@ -662,10 +662,11 b' def RepoForm(edit=False, old_data={}, su' | |||
|
662 | 662 | clone_uri = All(UnicodeString(strip=True, min=1, not_empty=False)) |
|
663 | 663 | repo_group = OneOf(repo_groups, hideList=True) |
|
664 | 664 | repo_type = OneOf(supported_backends) |
|
665 |
description = UnicodeString(strip=True, min=1, not_empty= |
|
|
665 | description = UnicodeString(strip=True, min=1, not_empty=False) | |
|
666 | 666 | private = StringBoolean(if_missing=False) |
|
667 | 667 | enable_statistics = StringBoolean(if_missing=False) |
|
668 | 668 | enable_downloads = StringBoolean(if_missing=False) |
|
669 | landing_rev = UnicodeString(strip=True, min=1, not_empty=True) | |
|
669 | 670 | |
|
670 | 671 | if edit: |
|
671 | 672 | #this is repo owner |
@@ -677,8 +678,8 b' def RepoForm(edit=False, old_data={}, su' | |||
|
677 | 678 | return _RepoForm |
|
678 | 679 | |
|
679 | 680 | |
|
680 |
def RepoForkForm(edit=False, old_data={}, |
|
|
681 | repo_groups=[]): | |
|
681 | def RepoForkForm(edit=False, old_data={}, | |
|
682 | supported_backends=BACKENDS.keys(), repo_groups=[]): | |
|
682 | 683 | class _RepoForkForm(formencode.Schema): |
|
683 | 684 | allow_extra_fields = True |
|
684 | 685 | filter_extra_fields = False |
@@ -696,8 +697,8 b' def RepoForkForm(edit=False, old_data={}' | |||
|
696 | 697 | return _RepoForkForm |
|
697 | 698 | |
|
698 | 699 | |
|
699 |
def RepoSettingsForm(edit=False, old_data={}, |
|
|
700 | repo_groups=[]): | |
|
700 | def RepoSettingsForm(edit=False, old_data={}, | |
|
701 | supported_backends=BACKENDS.keys(), repo_groups=[]): | |
|
701 | 702 | class _RepoForm(formencode.Schema): |
|
702 | 703 | allow_extra_fields = True |
|
703 | 704 | filter_extra_fields = False |
@@ -706,7 +707,7 b' def RepoSettingsForm(edit=False, old_dat' | |||
|
706 | 707 | description = UnicodeString(strip=True, min=1, not_empty=True) |
|
707 | 708 | repo_group = OneOf(repo_groups, hideList=True) |
|
708 | 709 | private = StringBoolean(if_missing=False) |
|
709 | ||
|
710 | landing_rev = UnicodeString(strip=True, min=1, not_empty=True) | |
|
710 | 711 | chained_validators = [ValidRepoName(edit, old_data), ValidPerms(), |
|
711 | 712 | ValidSettings] |
|
712 | 713 | return _RepoForm |
@@ -29,6 +29,7 b' import logging' | |||
|
29 | 29 | import cStringIO |
|
30 | 30 | |
|
31 | 31 | from sqlalchemy import func |
|
32 | from pylons.i18n.translation import _ | |
|
32 | 33 | |
|
33 | 34 | from rhodecode.lib.vcs import get_backend |
|
34 | 35 | from rhodecode.lib.vcs.exceptions import RepositoryError |
@@ -472,3 +473,33 b' class ScmModel(BaseModel):' | |||
|
472 | 473 | |
|
473 | 474 | def get_unread_journal(self): |
|
474 | 475 | return self.sa.query(UserLog).count() |
|
476 | ||
|
477 | def get_repo_landing_revs(self, repo=None): | |
|
478 | """ | |
|
479 | Generates select option with tags branches and bookmarks (for hg only) | |
|
480 | grouped by type | |
|
481 | ||
|
482 | :param repo: | |
|
483 | :type repo: | |
|
484 | """ | |
|
485 | hist_l = [] | |
|
486 | repo = self.__get_repo(repo) | |
|
487 | hist_l.append(['tip', _('latest tip')]) | |
|
488 | if not repo: | |
|
489 | return hist_l | |
|
490 | ||
|
491 | repo = repo.scm_instance | |
|
492 | branches_group = ([(k, k) for k, v in | |
|
493 | repo.branches.iteritems()], _("Branches")) | |
|
494 | hist_l.append(branches_group) | |
|
495 | ||
|
496 | if repo.alias == 'hg': | |
|
497 | bookmarks_group = ([(k, k) for k, v in | |
|
498 | repo.bookmarks.iteritems()], _("Bookmarks")) | |
|
499 | hist_l.append(bookmarks_group) | |
|
500 | ||
|
501 | tags_group = ([(k, k) for k, v in | |
|
502 | repo.tags.iteritems()], _("Tags")) | |
|
503 | hist_l.append(tags_group) | |
|
504 | ||
|
505 | return hist_l |
@@ -42,6 +42,15 b'' | |||
|
42 | 42 | <span class="help-block">${_('Type of repository to create.')}</span> |
|
43 | 43 | </div> |
|
44 | 44 | </div> |
|
45 | <div class="field"> | |
|
46 | <div class="label"> | |
|
47 | <label for="landing_rev">${_('Landing revision')}:</label> | |
|
48 | </div> | |
|
49 | <div class="input"> | |
|
50 | ${h.select('landing_rev','',c.landing_revs,class_="medium")} | |
|
51 | <span class="help-block">${_('Default revision for files page, downloads, whoosh and readme')}</span> | |
|
52 | </div> | |
|
53 | </div> | |
|
45 | 54 | <div class="field"> |
|
46 | 55 | <div class="label label-textarea"> |
|
47 | 56 | <label for="description">${_('Description')}:</label> |
@@ -62,6 +62,15 b'' | |||
|
62 | 62 | </div> |
|
63 | 63 | </div> |
|
64 | 64 | <div class="field"> |
|
65 | <div class="label"> | |
|
66 | <label for="landing_rev">${_('Landing revision')}:</label> | |
|
67 | </div> | |
|
68 | <div class="input"> | |
|
69 | ${h.select('landing_rev','',c.landing_revs,class_="medium")} | |
|
70 | <span class="help-block">${_('Default revision for files page, downloads, whoosh and readme')}</span> | |
|
71 | </div> | |
|
72 | </div> | |
|
73 | <div class="field"> | |
|
65 | 74 | <div class="label label-textarea"> |
|
66 | 75 | <label for="description">${_('Description')}:</label> |
|
67 | 76 | </div> |
@@ -210,7 +219,7 b'' | |||
|
210 | 219 | </div> |
|
211 | 220 | ${h.end_form()} |
|
212 | 221 | |
|
213 | <h3>${_('Set as fork')}</h3> | |
|
222 | <h3>${_('Set as fork of')}</h3> | |
|
214 | 223 | ${h.form(url('repo_as_fork', repo_name=c.repo_info.repo_name),method='put')} |
|
215 | 224 | <div class="form"> |
|
216 | 225 | <div class="fields"> |
@@ -219,7 +228,7 b'' | |||
|
219 | 228 | </div> |
|
220 | 229 | <div class="field" style="border:none;color:#888"> |
|
221 | 230 | <ul> |
|
222 | <li>${_('''Manually set this repository as a fork of another''')}</li> | |
|
231 | <li>${_('''Manually set this repository as a fork of another from the list''')}</li> | |
|
223 | 232 | </ul> |
|
224 | 233 | </div> |
|
225 | 234 | </div> |
@@ -38,13 +38,14 b' if not is_windows:' | |||
|
38 | 38 | log = logging.getLogger(__name__) |
|
39 | 39 | |
|
40 | 40 | __all__ = [ |
|
41 |
'environ', 'url', 'TestController', 'TESTS_TMP_PATH', |
|
|
42 |
'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', |
|
|
43 | 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_REGULAR_LOGIN', | |
|
41 | 'environ', 'url', 'get_new_dir', 'TestController', 'TESTS_TMP_PATH', | |
|
42 | 'HG_REPO', 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', | |
|
43 | 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_REGULAR_LOGIN', | |
|
44 | 44 | 'TEST_USER_REGULAR_PASS', 'TEST_USER_REGULAR_EMAIL', |
|
45 | 45 | 'TEST_USER_REGULAR2_LOGIN', 'TEST_USER_REGULAR2_PASS', |
|
46 |
'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO', 'TEST_G |
|
|
47 | 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', 'SCM_TESTS', | |
|
46 | 'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO', 'TEST_HG_REPO_CLONE', | |
|
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 | 51 | # Invoke websetup with the current config file |
@@ -83,22 +84,27 b" GIT_FORK = 'vcs_test_git_fork'" | |||
|
83 | 84 | SCM_TESTS = ['hg', 'git'] |
|
84 | 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 | 89 | TEST_GIT_REPO = jn(TESTS_TMP_PATH, GIT_REPO) |
|
90 | 90 | TEST_GIT_REPO_CLONE = jn(TESTS_TMP_PATH, 'vcsgitclone%s' % uniq_suffix) |
|
91 | 91 | TEST_GIT_REPO_PULL = jn(TESTS_TMP_PATH, 'vcsgitpull%s' % uniq_suffix) |
|
92 | 92 | |
|
93 | 93 | |
|
94 | 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 | 97 | TEST_HG_REPO_CLONE = jn(TESTS_TMP_PATH, 'vcshgclone%s' % uniq_suffix) |
|
97 | 98 | TEST_HG_REPO_PULL = jn(TESTS_TMP_PATH, 'vcshgpull%s' % uniq_suffix) |
|
98 | 99 | |
|
99 | 100 | TEST_DIR = tempfile.gettempdir() |
|
100 | 101 | TEST_REPO_PREFIX = 'vcs-test' |
|
101 | 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) | |
|
107 | ||
|
102 | 108 | |
|
103 | 109 | def get_new_dir(title): |
|
104 | 110 | """ |
@@ -114,12 +120,6 b' def get_new_dir(title):' | |||
|
114 | 120 | return get_normalized_path(path) |
|
115 | 121 | |
|
116 | 122 | |
|
117 | PACKAGE_DIR = os.path.abspath(os.path.join( | |
|
118 | os.path.dirname(__file__), '..')) | |
|
119 | ||
|
120 | TEST_USER_CONFIG_FILE = jn(THIS, 'aconfig') | |
|
121 | ||
|
122 | ||
|
123 | 123 | class TestController(TestCase): |
|
124 | 124 | |
|
125 | 125 | def __init__(self, *args, **kwargs): |
@@ -6,6 +6,7 b' from rhodecode.lib import vcs' | |||
|
6 | 6 | from rhodecode.model.db import Repository |
|
7 | 7 | from rhodecode.tests import * |
|
8 | 8 | |
|
9 | ||
|
9 | 10 | class TestAdminReposController(TestController): |
|
10 | 11 | |
|
11 | 12 | def __make_repo(self): |
@@ -24,17 +25,19 b' class TestAdminReposController(TestContr' | |||
|
24 | 25 | repo_name = NEW_HG_REPO |
|
25 | 26 | description = 'description for newly created repo' |
|
26 | 27 | private = False |
|
27 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |
|
28 | 'repo_type':'hg', | |
|
29 | 'clone_uri':'', | |
|
30 | 'repo_group':'', | |
|
31 | 'description':description, | |
|
32 |
'private':private |
|
|
33 | self.checkSessionFlash(response, 'created repository %s' % (repo_name)) | |
|
28 | response = self.app.post(url('repos'), {'repo_name': repo_name, | |
|
29 | 'repo_type': 'hg', | |
|
30 | 'clone_uri': '', | |
|
31 | 'repo_group': '', | |
|
32 | 'description': description, | |
|
33 | 'private': private, | |
|
34 | 'landing_rev': 'tip'}) | |
|
35 | self.checkSessionFlash(response, | |
|
36 | 'created repository %s' % (repo_name)) | |
|
34 | 37 | |
|
35 | 38 | #test if the repo was created in the database |
|
36 |
new_repo = self.Session.query(Repository) |
|
|
37 | repo_name).one() | |
|
39 | new_repo = self.Session.query(Repository)\ | |
|
40 | .filter(Repository.repo_name == repo_name).one() | |
|
38 | 41 | |
|
39 | 42 | self.assertEqual(new_repo.repo_name, repo_name) |
|
40 | 43 | self.assertEqual(new_repo.description, description) |
@@ -42,15 +45,13 b' class TestAdminReposController(TestContr' | |||
|
42 | 45 | #test if repository is visible in the list ? |
|
43 | 46 | response = response.follow() |
|
44 | 47 | |
|
45 | self.assertTrue(repo_name in response.body) | |
|
46 | ||
|
48 | response.mustcontain(repo_name) | |
|
47 | 49 | |
|
48 | 50 | #test if repository was created on filesystem |
|
49 | 51 | try: |
|
50 | 52 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
|
51 | 53 | except: |
|
52 | self.fail('no repo in filesystem') | |
|
53 | ||
|
54 | self.fail('no repo %s in filesystem' % repo_name) | |
|
54 | 55 | |
|
55 | 56 | def test_create_hg_non_ascii(self): |
|
56 | 57 | self.log_user() |
@@ -60,18 +61,19 b' class TestAdminReposController(TestContr' | |||
|
60 | 61 | description = 'description for newly created repo' + non_ascii |
|
61 | 62 | description_unicode = description.decode('utf8') |
|
62 | 63 | private = False |
|
63 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |
|
64 | 'repo_type':'hg', | |
|
65 | 'clone_uri':'', | |
|
66 | 'repo_group':'', | |
|
67 | 'description':description, | |
|
68 |
'private':private |
|
|
64 | response = self.app.post(url('repos'), {'repo_name': repo_name, | |
|
65 | 'repo_type': 'hg', | |
|
66 | 'clone_uri': '', | |
|
67 | 'repo_group': '', | |
|
68 | 'description': description, | |
|
69 | 'private': private, | |
|
70 | 'landing_rev': 'tip'}) | |
|
69 | 71 | self.checkSessionFlash(response, |
|
70 | 72 | 'created repository %s' % (repo_name_unicode)) |
|
71 | 73 | |
|
72 | 74 | #test if the repo was created in the database |
|
73 |
new_repo = self.Session.query(Repository) |
|
|
74 | repo_name_unicode).one() | |
|
75 | new_repo = self.Session.query(Repository)\ | |
|
76 | .filter(Repository.repo_name == repo_name_unicode).one() | |
|
75 | 77 | |
|
76 | 78 | self.assertEqual(new_repo.repo_name, repo_name_unicode) |
|
77 | 79 | self.assertEqual(new_repo.description, description_unicode) |
@@ -79,52 +81,86 b' class TestAdminReposController(TestContr' | |||
|
79 | 81 | #test if repository is visible in the list ? |
|
80 | 82 | response = response.follow() |
|
81 | 83 | |
|
82 | self.assertTrue(repo_name in response.body) | |
|
84 | response.mustcontain(repo_name) | |
|
83 | 85 | |
|
84 | 86 | #test if repository was created on filesystem |
|
85 | 87 | try: |
|
86 | 88 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
|
87 | 89 | except: |
|
88 | self.fail('no repo in filesystem') | |
|
89 | ||
|
90 | self.fail('no repo %s in filesystem' % repo_name) | |
|
90 | 91 | |
|
91 | 92 | def test_create_hg_in_group(self): |
|
92 | 93 | #TODO: write test ! |
|
93 | 94 | pass |
|
94 | 95 | |
|
95 | 96 | def test_create_git(self): |
|
96 | return | |
|
97 | 97 | self.log_user() |
|
98 | 98 | repo_name = NEW_GIT_REPO |
|
99 | 99 | description = 'description for newly created repo' |
|
100 | 100 | private = False |
|
101 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |
|
102 | 'repo_type':'git', | |
|
103 | 'clone_uri':'', | |
|
104 | 'repo_group':'', | |
|
105 | 'description':description, | |
|
106 |
'private':private |
|
|
107 | ||
|
101 | response = self.app.post(url('repos'), {'repo_name': repo_name, | |
|
102 | 'repo_type': 'git', | |
|
103 | 'clone_uri': '', | |
|
104 | 'repo_group': '', | |
|
105 | 'description': description, | |
|
106 | 'private': private, | |
|
107 | 'landing_rev': 'tip'}) | |
|
108 | self.checkSessionFlash(response, | |
|
109 | 'created repository %s' % (repo_name)) | |
|
108 | 110 | |
|
109 | #test if we have a message for that repository | |
|
110 | assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo' | |
|
111 | #test if the repo was created in the database | |
|
112 | new_repo = self.Session.query(Repository)\ | |
|
113 | .filter(Repository.repo_name == repo_name).one() | |
|
111 | 114 | |
|
112 | #test if the fork was created in the database | |
|
113 | new_repo = self.Session.query(Repository).filter(Repository.repo_name == repo_name).one() | |
|
114 | ||
|
115 | assert new_repo.repo_name == repo_name, 'wrong name of repo name in db' | |
|
116 | assert new_repo.description == description, 'wrong description' | |
|
115 | self.assertEqual(new_repo.repo_name, repo_name) | |
|
116 | self.assertEqual(new_repo.description, description) | |
|
117 | 117 | |
|
118 | 118 | #test if repository is visible in the list ? |
|
119 | 119 | response = response.follow() |
|
120 | 120 | |
|
121 | assert repo_name in response.body, 'missing new repo from the main repos list' | |
|
121 | response.mustcontain(repo_name) | |
|
122 | 122 | |
|
123 | 123 | #test if repository was created on filesystem |
|
124 | 124 | try: |
|
125 | 125 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
|
126 | 126 | except: |
|
127 |
|
|
|
127 | self.fail('no repo %s in filesystem' % repo_name) | |
|
128 | ||
|
129 | def test_create_git_non_ascii(self): | |
|
130 | self.log_user() | |
|
131 | non_ascii = "ąęł" | |
|
132 | repo_name = "%s%s" % (NEW_GIT_REPO, non_ascii) | |
|
133 | repo_name_unicode = repo_name.decode('utf8') | |
|
134 | description = 'description for newly created repo' + non_ascii | |
|
135 | description_unicode = description.decode('utf8') | |
|
136 | private = False | |
|
137 | response = self.app.post(url('repos'), {'repo_name': repo_name, | |
|
138 | 'repo_type': 'git', | |
|
139 | 'clone_uri': '', | |
|
140 | 'repo_group': '', | |
|
141 | 'description': description, | |
|
142 | 'private': private, | |
|
143 | 'landing_rev': 'tip'}) | |
|
144 | self.checkSessionFlash(response, | |
|
145 | 'created repository %s' % (repo_name_unicode)) | |
|
146 | ||
|
147 | #test if the repo was created in the database | |
|
148 | new_repo = self.Session.query(Repository)\ | |
|
149 | .filter(Repository.repo_name == repo_name_unicode).one() | |
|
150 | ||
|
151 | self.assertEqual(new_repo.repo_name, repo_name_unicode) | |
|
152 | self.assertEqual(new_repo.description, description_unicode) | |
|
153 | ||
|
154 | #test if repository is visible in the list ? | |
|
155 | response = response.follow() | |
|
156 | ||
|
157 | response.mustcontain(repo_name) | |
|
158 | ||
|
159 | #test if repository was created on filesystem | |
|
160 | try: | |
|
161 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) | |
|
162 | except: | |
|
163 | self.fail('no repo %s in filesystem' % repo_name) | |
|
128 | 164 | |
|
129 | 165 | def test_new(self): |
|
130 | 166 | self.log_user() |
@@ -140,27 +176,24 b' class TestAdminReposController(TestContr' | |||
|
140 | 176 | response = self.app.post(url('repo', repo_name=HG_REPO), |
|
141 | 177 | params=dict(_method='put')) |
|
142 | 178 | |
|
143 | def test_delete(self): | |
|
179 | def test_delete_hg(self): | |
|
144 | 180 | self.log_user() |
|
145 | 181 | repo_name = 'vcs_test_new_to_delete' |
|
146 | 182 | description = 'description for newly created repo' |
|
147 | 183 | private = False |
|
148 | ||
|
149 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |
|
150 |
' |
|
|
151 |
' |
|
|
152 |
' |
|
|
153 |
' |
|
|
154 |
' |
|
|
155 | self.assertTrue('flash' in response.session) | |
|
156 | ||
|
157 | #test if we have a message for that repository | |
|
158 | self.assertTrue('''created repository %s''' % (repo_name) in | |
|
159 | response.session['flash'][0]) | |
|
184 | response = self.app.post(url('repos'), {'repo_name': repo_name, | |
|
185 | 'repo_type': 'hg', | |
|
186 | 'clone_uri': '', | |
|
187 | 'repo_group': '', | |
|
188 | 'description': description, | |
|
189 | 'private': private, | |
|
190 | 'landing_rev': 'tip'}) | |
|
191 | self.checkSessionFlash(response, | |
|
192 | 'created repository %s' % (repo_name)) | |
|
160 | 193 | |
|
161 | 194 | #test if the repo was created in the database |
|
162 |
new_repo = self.Session.query(Repository) |
|
|
163 | repo_name).one() | |
|
195 | new_repo = self.Session.query(Repository)\ | |
|
196 | .filter(Repository.repo_name == repo_name).one() | |
|
164 | 197 | |
|
165 | 198 | self.assertEqual(new_repo.repo_name, repo_name) |
|
166 | 199 | self.assertEqual(new_repo.description, description) |
@@ -168,8 +201,13 b' class TestAdminReposController(TestContr' | |||
|
168 | 201 | #test if repository is visible in the list ? |
|
169 | 202 | response = response.follow() |
|
170 | 203 | |
|
171 | self.assertTrue(repo_name in response.body) | |
|
204 | response.mustcontain(repo_name) | |
|
172 | 205 | |
|
206 | #test if repository was created on filesystem | |
|
207 | try: | |
|
208 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) | |
|
209 | except: | |
|
210 | self.fail('no repo %s in filesystem' % repo_name) | |
|
173 | 211 | |
|
174 | 212 | response = self.app.delete(url('repo', repo_name=repo_name)) |
|
175 | 213 | |
@@ -179,32 +217,79 b' class TestAdminReposController(TestContr' | |||
|
179 | 217 | response.follow() |
|
180 | 218 | |
|
181 | 219 | #check if repo was deleted from db |
|
182 |
deleted_repo = self.Session.query(Repository) |
|
|
183 | == repo_name).scalar() | |
|
220 | deleted_repo = self.Session.query(Repository)\ | |
|
221 | .filter(Repository.repo_name == repo_name).scalar() | |
|
184 | 222 | |
|
185 | 223 | self.assertEqual(deleted_repo, None) |
|
186 | 224 | |
|
225 | self.assertEqual(os.path.isdir(os.path.join(TESTS_TMP_PATH, repo_name)), | |
|
226 | False) | |
|
227 | ||
|
228 | def test_delete_git(self): | |
|
229 | self.log_user() | |
|
230 | repo_name = 'vcs_test_new_to_delete' | |
|
231 | description = 'description for newly created repo' | |
|
232 | private = False | |
|
233 | response = self.app.post(url('repos'), {'repo_name': repo_name, | |
|
234 | 'repo_type': 'git', | |
|
235 | 'clone_uri': '', | |
|
236 | 'repo_group': '', | |
|
237 | 'description': description, | |
|
238 | 'private': private, | |
|
239 | 'landing_rev': 'tip'}) | |
|
240 | self.checkSessionFlash(response, | |
|
241 | 'created repository %s' % (repo_name)) | |
|
242 | ||
|
243 | #test if the repo was created in the database | |
|
244 | new_repo = self.Session.query(Repository)\ | |
|
245 | .filter(Repository.repo_name == repo_name).one() | |
|
246 | ||
|
247 | self.assertEqual(new_repo.repo_name, repo_name) | |
|
248 | self.assertEqual(new_repo.description, description) | |
|
249 | ||
|
250 | #test if repository is visible in the list ? | |
|
251 | response = response.follow() | |
|
252 | ||
|
253 | response.mustcontain(repo_name) | |
|
254 | ||
|
255 | #test if repository was created on filesystem | |
|
256 | try: | |
|
257 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) | |
|
258 | except: | |
|
259 | self.fail('no repo %s in filesystem' % repo_name) | |
|
260 | ||
|
261 | response = self.app.delete(url('repo', repo_name=repo_name)) | |
|
262 | ||
|
263 | self.assertTrue('''deleted repository %s''' % (repo_name) in | |
|
264 | response.session['flash'][0]) | |
|
265 | ||
|
266 | response.follow() | |
|
267 | ||
|
268 | #check if repo was deleted from db | |
|
269 | deleted_repo = self.Session.query(Repository)\ | |
|
270 | .filter(Repository.repo_name == repo_name).scalar() | |
|
271 | ||
|
272 | self.assertEqual(deleted_repo, None) | |
|
273 | ||
|
274 | self.assertEqual(os.path.isdir(os.path.join(TESTS_TMP_PATH, repo_name)), | |
|
275 | False) | |
|
187 | 276 | |
|
188 | 277 | def test_delete_repo_with_group(self): |
|
189 | 278 | #TODO: |
|
190 | 279 | pass |
|
191 | 280 | |
|
192 | ||
|
193 | 281 | def test_delete_browser_fakeout(self): |
|
194 | 282 | response = self.app.post(url('repo', repo_name=HG_REPO), |
|
195 | 283 | params=dict(_method='delete')) |
|
196 | 284 | |
|
197 | def test_show(self): | |
|
285 | def test_show_hg(self): | |
|
198 | 286 | self.log_user() |
|
199 | 287 | response = self.app.get(url('repo', repo_name=HG_REPO)) |
|
200 | 288 | |
|
201 |
def test_show_ |
|
|
202 | response = self.app.get(url('formatted_repo', repo_name=HG_REPO, | |
|
203 | format='xml')) | |
|
289 | def test_show_git(self): | |
|
290 | self.log_user() | |
|
291 | response = self.app.get(url('repo', repo_name=GIT_REPO)) | |
|
292 | ||
|
204 | 293 | |
|
205 | 294 | def test_edit(self): |
|
206 | 295 | response = self.app.get(url('edit_repo', repo_name=HG_REPO)) |
|
207 | ||
|
208 | def test_edit_as_xml(self): | |
|
209 | response = self.app.get(url('formatted_edit_repo', repo_name=HG_REPO, | |
|
210 | format='xml')) |
@@ -28,7 +28,7 b' class TestForksController(TestController' | |||
|
28 | 28 | |
|
29 | 29 | self.assertTrue("""There are no forks yet""" in response.body) |
|
30 | 30 | |
|
31 | def test_index_with_fork(self): | |
|
31 | def test_index_with_fork_hg(self): | |
|
32 | 32 | self.log_user() |
|
33 | 33 | |
|
34 | 34 | # create a fork |
@@ -39,19 +39,49 b' class TestForksController(TestController' | |||
|
39 | 39 | response = self.app.post(url(controller='forks', |
|
40 | 40 | action='fork_create', |
|
41 | 41 | repo_name=repo_name), |
|
42 | {'repo_name':fork_name, | |
|
43 | 'repo_group':'', | |
|
44 | 'fork_parent_id':org_repo.repo_id, | |
|
45 | 'repo_type':'hg', | |
|
46 | 'description':description, | |
|
47 |
'private':'False' |
|
|
42 | {'repo_name': fork_name, | |
|
43 | 'repo_group': '', | |
|
44 | 'fork_parent_id': org_repo.repo_id, | |
|
45 | 'repo_type': 'hg', | |
|
46 | 'description': description, | |
|
47 | 'private': 'False', | |
|
48 | 'landing_rev': 'tip'}) | |
|
48 | 49 | |
|
49 | 50 | response = self.app.get(url(controller='forks', action='forks', |
|
50 | 51 | repo_name=repo_name)) |
|
51 | 52 | |
|
52 | self.assertTrue("""<a href="/%s/summary">""" | |
|
53 | """vcs_test_hg_fork</a>""" % fork_name | |
|
54 | in response.body) | |
|
53 | response.mustcontain( | |
|
54 | """<a href="/%s/summary">%s</a>""" % (fork_name, fork_name) | |
|
55 | ) | |
|
56 | ||
|
57 | #remove this fork | |
|
58 | response = self.app.delete(url('repo', repo_name=fork_name)) | |
|
59 | ||
|
60 | def test_index_with_fork_git(self): | |
|
61 | self.log_user() | |
|
62 | ||
|
63 | # create a fork | |
|
64 | fork_name = GIT_FORK | |
|
65 | description = 'fork of vcs test' | |
|
66 | repo_name = GIT_REPO | |
|
67 | org_repo = Repository.get_by_repo_name(repo_name) | |
|
68 | response = self.app.post(url(controller='forks', | |
|
69 | action='fork_create', | |
|
70 | repo_name=repo_name), | |
|
71 | {'repo_name': fork_name, | |
|
72 | 'repo_group': '', | |
|
73 | 'fork_parent_id': org_repo.repo_id, | |
|
74 | 'repo_type': 'git', | |
|
75 | 'description': description, | |
|
76 | 'private': 'False', | |
|
77 | 'landing_rev': 'tip'}) | |
|
78 | ||
|
79 | response = self.app.get(url(controller='forks', action='forks', | |
|
80 | repo_name=repo_name)) | |
|
81 | ||
|
82 | response.mustcontain( | |
|
83 | """<a href="/%s/summary">%s</a>""" % (fork_name, fork_name) | |
|
84 | ) | |
|
55 | 85 | |
|
56 | 86 | #remove this fork |
|
57 | 87 | response = self.app.delete(url('repo', repo_name=fork_name)) |
@@ -69,11 +99,12 b' class TestForksController(TestController' | |||
|
69 | 99 | 'fork_parent_id':org_repo.repo_id, |
|
70 | 100 | 'repo_type':'hg', |
|
71 | 101 | 'description':description, |
|
72 |
'private':'False' |
|
|
102 | 'private':'False', | |
|
103 | 'landing_rev': 'tip'}) | |
|
73 | 104 | |
|
74 | 105 | #test if we have a message that fork is ok |
|
75 | self.assertTrue('forked %s repository as %s' \ | |
|
76 |
|
|
|
106 | self.checkSessionFlash(response, | |
|
107 | 'forked %s repository as %s' % (repo_name, fork_name)) | |
|
77 | 108 | |
|
78 | 109 | #test if the fork was created in the database |
|
79 | 110 | fork_repo = self.Session.query(Repository)\ |
@@ -85,10 +116,6 b' class TestForksController(TestController' | |||
|
85 | 116 | #test if fork is visible in the list ? |
|
86 | 117 | response = response.follow() |
|
87 | 118 | |
|
88 | # check if fork is marked as fork | |
|
89 | # wait for cache to expire | |
|
90 | import time | |
|
91 | time.sleep(10) | |
|
92 | 119 | response = self.app.get(url(controller='summary', action='index', |
|
93 | 120 | repo_name=fork_name)) |
|
94 | 121 |
@@ -1,5 +1,5 b'' | |||
|
1 | import os | |
|
1 | 2 | from rhodecode.tests import * |
|
2 | import os | |
|
3 | 3 | from nose.plugins.skip import SkipTest |
|
4 | 4 | |
|
5 | 5 | |
@@ -27,8 +27,7 b' class TestSearchController(TestControlle' | |||
|
27 | 27 | self.log_user() |
|
28 | 28 | response = self.app.get(url(controller='search', action='index'), |
|
29 | 29 | {'q': 'def repo'}) |
|
30 |
response.mustcontain(' |
|
|
31 | response.mustcontain('Permission denied') | |
|
30 | response.mustcontain('39 results') | |
|
32 | 31 | |
|
33 | 32 | def test_repo_search(self): |
|
34 | 33 | self.log_user() |
@@ -36,4 +35,3 b' class TestSearchController(TestControlle' | |||
|
36 | 35 | {'q': 'repository:%s def test' % HG_REPO}) |
|
37 | 36 | |
|
38 | 37 | response.mustcontain('4 results') |
|
39 | response.mustcontain('Permission denied') |
@@ -92,7 +92,7 b' class TestSummaryController(TestControll' | |||
|
92 | 92 | #repo type |
|
93 | 93 | response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ |
|
94 | 94 | """title="Git repository" alt="Git """ |
|
95 |
"""repository" src="/images/icons/ |
|
|
95 | """repository" src="/images/icons/giticon.png"/>""") | |
|
96 | 96 | response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ |
|
97 | 97 | """title="public repository" alt="public """ |
|
98 | 98 | """repository" src="/images/icons/lock_open.png"/>""") |
@@ -136,7 +136,8 b' class TestReposGroups(unittest.TestCase)' | |||
|
136 | 136 | repo_group=None, |
|
137 | 137 | private=False, |
|
138 | 138 | repo_type='hg', |
|
139 |
clone_uri=None |
|
|
139 | clone_uri=None, | |
|
140 | landing_rev='tip') | |
|
140 | 141 | cur_user = User.get_by_username(TEST_USER_ADMIN_LOGIN) |
|
141 | 142 | r = RepoModel().create(form_data, cur_user) |
|
142 | 143 | |
@@ -608,7 +609,6 b' class TestPermissions(unittest.TestCase)' | |||
|
608 | 609 | user=self.anon, |
|
609 | 610 | perm='group.none') |
|
610 | 611 | |
|
611 | ||
|
612 | 612 | u1_auth = AuthUser(user_id=self.u1.user_id) |
|
613 | 613 | self.assertEqual(u1_auth.permissions['repositories_groups'], |
|
614 | 614 | {u'group1': u'group.none', u'group2': u'group.none'}) |
@@ -619,13 +619,14 b' class TestPermissions(unittest.TestCase)' | |||
|
619 | 619 | |
|
620 | 620 | # add repo to group |
|
621 | 621 | form_data = { |
|
622 | 'repo_name':HG_REPO, | |
|
623 | 'repo_name_full':RepoGroup.url_sep().join([self.g1.group_name,HG_REPO]), | |
|
624 | 'repo_type':'hg', | |
|
625 | 'clone_uri':'', | |
|
626 | 'repo_group':self.g1.group_id, | |
|
627 | 'description':'desc', | |
|
628 | 'private':False | |
|
622 | 'repo_name': HG_REPO, | |
|
623 | 'repo_name_full': RepoGroup.url_sep().join([self.g1.group_name,HG_REPO]), | |
|
624 | 'repo_type': 'hg', | |
|
625 | 'clone_uri': '', | |
|
626 | 'repo_group': self.g1.group_id, | |
|
627 | 'description': 'desc', | |
|
628 | 'private': False, | |
|
629 | 'landing_rev': 'tip' | |
|
629 | 630 | } |
|
630 | 631 | self.test_repo = RepoModel().create(form_data, cur_user=self.u1) |
|
631 | 632 | Session.commit() |
@@ -52,5 +52,5 b' def setup_package():' | |||
|
52 | 52 | except VCSTestError, err: |
|
53 | 53 | raise RuntimeError(str(err)) |
|
54 | 54 | |
|
55 | start_dir = os.path.abspath(os.path.dirname(__file__)) | |
|
56 | unittest.defaultTestLoader.discover(start_dir) | |
|
55 | #start_dir = os.path.abspath(os.path.dirname(__file__)) | |
|
56 | #unittest.defaultTestLoader.discover(start_dir) |
@@ -1,59 +1,60 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | Unit tests configuration module for vcs. |
|
3 | 3 | """ |
|
4 | ||
|
4 | 5 | import os |
|
5 | 6 | import time |
|
6 | 7 | import hashlib |
|
7 | 8 | import tempfile |
|
8 | 9 | import datetime |
|
9 | ||
|
10 | from rhodecode.tests import * | |
|
10 | 11 | from utils import get_normalized_path |
|
11 | 12 | from os.path import join as jn |
|
12 | 13 | |
|
13 | __all__ = ( | |
|
14 | 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', | |
|
15 | 'SCM_TESTS', | |
|
16 | ) | |
|
17 | ||
|
18 | SCM_TESTS = ['hg', 'git'] | |
|
19 | uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) | |
|
20 | ||
|
14 | TEST_TMP_PATH = TESTS_TMP_PATH | |
|
15 | #__all__ = ( | |
|
16 | # 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', | |
|
17 | # 'SCM_TESTS', | |
|
18 | #) | |
|
19 | # | |
|
20 | #SCM_TESTS = ['hg', 'git'] | |
|
21 | #uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) | |
|
22 | # | |
|
21 | 23 | THIS = os.path.abspath(os.path.dirname(__file__)) |
|
22 | ||
|
23 | GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git' | |
|
24 | ||
|
25 | TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp') | |
|
26 | TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO', | |
|
27 | jn(TEST_TMP_PATH, 'vcs-git')) | |
|
28 | TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE', | |
|
29 | jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)) | |
|
30 | TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL', | |
|
31 | jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)) | |
|
32 | ||
|
33 | HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' | |
|
34 | TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO', | |
|
35 | jn(TEST_TMP_PATH, 'vcs-hg')) | |
|
36 | TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE', | |
|
37 | jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix)) | |
|
38 | TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL', | |
|
39 | jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix)) | |
|
40 | ||
|
41 | TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir()) | |
|
42 | TEST_REPO_PREFIX = 'vcs-test' | |
|
43 | ||
|
44 | ||
|
45 | def get_new_dir(title): | |
|
46 | """ | |
|
47 | Returns always new directory path. | |
|
48 |
|
|
|
49 | name = TEST_REPO_PREFIX | |
|
50 | if title: | |
|
51 | name = '-'.join((name, title)) | |
|
52 | hex = hashlib.sha1(str(time.time())).hexdigest() | |
|
53 | name = '-'.join((name, hex)) | |
|
54 | path = os.path.join(TEST_DIR, name) | |
|
55 | return get_normalized_path(path) | |
|
56 | ||
|
24 | # | |
|
25 | #GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git' | |
|
26 | # | |
|
27 | #TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp') | |
|
28 | #TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO', | |
|
29 | # jn(TEST_TMP_PATH, 'vcs-git')) | |
|
30 | #TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE', | |
|
31 | # jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)) | |
|
32 | #TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL', | |
|
33 | # jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)) | |
|
34 | # | |
|
35 | #HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' | |
|
36 | #TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO', | |
|
37 | # jn(TEST_TMP_PATH, 'vcs-hg')) | |
|
38 | #TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE', | |
|
39 | # jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix)) | |
|
40 | #TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL', | |
|
41 | # jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix)) | |
|
42 | # | |
|
43 | #TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir()) | |
|
44 | #TEST_REPO_PREFIX = 'vcs-test' | |
|
45 | # | |
|
46 | # | |
|
47 | #def get_new_dir(title): | |
|
48 | # """ | |
|
49 | # Returns always new directory path. | |
|
50 | # """ | |
|
51 | # name = TEST_REPO_PREFIX | |
|
52 | # if title: | |
|
53 | # name = '-'.join((name, title)) | |
|
54 | # hex = hashlib.sha1(str(time.time())).hexdigest() | |
|
55 | # name = '-'.join((name, hex)) | |
|
56 | # path = os.path.join(TEST_DIR, name) | |
|
57 | # return get_normalized_path(path) | |
|
57 | 58 | |
|
58 | 59 | PACKAGE_DIR = os.path.abspath(os.path.join( |
|
59 | 60 | os.path.dirname(__file__), '..')) |
@@ -156,14 +156,10 b' class MercurialRepositoryTest(unittest.T' | |||
|
156 | 156 | |
|
157 | 157 | #active branches |
|
158 | 158 | self.assertTrue('default' in self.repo.branches) |
|
159 | ||
|
160 | #closed branches | |
|
161 | self.assertFalse('web' in self.repo.branches) | |
|
162 | self.assertFalse('git' in self.repo.branches) | |
|
159 | self.assertTrue('git' in self.repo.branches) | |
|
163 | 160 | |
|
164 | 161 | # closed |
|
165 |
self.assertTrue('w |
|
|
166 | self.assertTrue('webvcs' in self.repo._get_branches(closed=True)) | |
|
162 | self.assertTrue('web' in self.repo._get_branches(closed=True)) | |
|
167 | 163 | |
|
168 | 164 | for name, id in self.repo.branches.items(): |
|
169 | 165 | self.assertTrue(isinstance( |
|
1 | NO CONTENT: modified file, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now