Show More
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -52,8 +52,9 b' def load_environment(global_conf, app_co' | |||
|
52 | 52 | test = os.path.split(config['__file__'])[-1] == 'test.ini' |
|
53 | 53 | if test: |
|
54 | 54 | from rhodecode.lib.utils import create_test_env, create_test_index |
|
55 | create_test_env('/tmp', config) | |
|
56 | create_test_index('/tmp', True) | |
|
55 | from rhodecode.tests import TESTS_TMP_PATH | |
|
56 | create_test_env(TESTS_TMP_PATH, config) | |
|
57 | create_test_index(TESTS_TMP_PATH, True) | |
|
57 | 58 | |
|
58 | 59 | #MULTIPLE DB configs |
|
59 | 60 | # Setup the SQLAlchemy database engine |
@@ -22,11 +22,11 b' Created on Aug 7, 2010' | |||
|
22 | 22 | search controller for pylons |
|
23 | 23 | @author: marcink |
|
24 | 24 | """ |
|
25 | from pylons import request, response, session, tmpl_context as c, url | |
|
25 | from pylons import request, response, config, session, tmpl_context as c, url | |
|
26 | 26 | from pylons.controllers.util import abort, redirect |
|
27 | 27 | from rhodecode.lib.auth import LoginRequired |
|
28 | 28 | from rhodecode.lib.base import BaseController, render |
|
29 |
from rhodecode.lib.indexers import |
|
|
29 | from rhodecode.lib.indexers import SCHEMA, IDX_NAME, ResultWrapper | |
|
30 | 30 | from webhelpers.paginate import Page |
|
31 | 31 | from webhelpers.util import update_params |
|
32 | 32 | from pylons.i18n.translation import _ |
@@ -64,7 +64,8 b' class SearchController(BaseController):' | |||
|
64 | 64 | p = int(request.params.get('page', 1)) |
|
65 | 65 | highlight_items = set() |
|
66 | 66 | try: |
|
67 |
idx = open_dir( |
|
|
67 | idx = open_dir(config['app_conf']['index_dir'] | |
|
68 | , indexname=IDX_NAME) | |
|
68 | 69 | searcher = idx.searcher() |
|
69 | 70 | |
|
70 | 71 | qp = QueryParser(search_type, schema=SCHEMA) |
@@ -64,7 +64,7 b' def is_git(environ):' | |||
|
64 | 64 | :param environ: |
|
65 | 65 | """ |
|
66 | 66 | http_user_agent = environ.get('HTTP_USER_AGENT') |
|
67 | if http_user_agent.startswith('git'): | |
|
67 | if http_user_agent and http_user_agent.startswith('git'): | |
|
68 | 68 | return True |
|
69 | 69 | return False |
|
70 | 70 | |
@@ -455,15 +455,16 b' def create_test_index(repo_location, ful' | |||
|
455 | 455 | """ |
|
456 | 456 | from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon |
|
457 | 457 | from rhodecode.lib.pidlock import DaemonLock, LockHeld |
|
458 | from rhodecode.lib.indexers import IDX_LOCATION | |
|
459 | 458 | import shutil |
|
460 | 459 | |
|
461 | if os.path.exists(IDX_LOCATION): | |
|
462 | shutil.rmtree(IDX_LOCATION) | |
|
460 | index_location = os.path.join(repo_location, 'index') | |
|
461 | if os.path.exists(index_location): | |
|
462 | shutil.rmtree(index_location) | |
|
463 | 463 | |
|
464 | 464 | try: |
|
465 | 465 | l = DaemonLock() |
|
466 |
WhooshIndexingDaemon( |
|
|
466 | WhooshIndexingDaemon(index_location=index_location, | |
|
467 | repo_location=repo_location)\ | |
|
467 | 468 | .run(full_index=full_index) |
|
468 | 469 | l.release() |
|
469 | 470 | except LockHeld: |
@@ -474,6 +475,8 b' def create_test_env(repos_test_path, con' | |||
|
474 | 475 | install test repository into tmp dir |
|
475 | 476 | """ |
|
476 | 477 | from rhodecode.lib.db_manage import DbManage |
|
478 | from rhodecode.tests import HG_REPO, GIT_REPO, NEW_HG_REPO, NEW_GIT_REPO, \ | |
|
479 | HG_FORK, GIT_FORK, TESTS_TMP_PATH | |
|
477 | 480 | import tarfile |
|
478 | 481 | import shutil |
|
479 | 482 | from os.path import dirname as dn, join as jn, abspath |
@@ -509,13 +512,19 b' def create_test_env(repos_test_path, con' | |||
|
509 | 512 | dbmanage.populate_default_permissions() |
|
510 | 513 | |
|
511 | 514 | #PART TWO make test repo |
|
512 | log.debug('making test vcs repo') | |
|
513 | if os.path.isdir('/tmp/vcs_test'): | |
|
514 | shutil.rmtree('/tmp/vcs_test') | |
|
515 | log.debug('making test vcs repositories') | |
|
516 | ||
|
517 | #remove old one from previos tests | |
|
518 | for r in [HG_REPO, GIT_REPO, NEW_HG_REPO, NEW_GIT_REPO, HG_FORK, GIT_FORK]: | |
|
515 | 519 | |
|
520 | if os.path.isdir(jn(TESTS_TMP_PATH, r)): | |
|
521 | log.debug('removing %s', r) | |
|
522 | shutil.rmtree(jn(TESTS_TMP_PATH, r)) | |
|
523 | ||
|
524 | #CREATE DEFAULT HG REPOSITORY | |
|
516 | 525 | cur_dir = dn(dn(abspath(__file__))) |
|
517 | tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test.tar.gz")) | |
|
518 | tar.extractall('/tmp') | |
|
526 | tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test_hg.tar.gz")) | |
|
527 | tar.extractall(jn(TESTS_TMP_PATH, HG_REPO)) | |
|
519 | 528 | tar.close() |
|
520 | 529 | |
|
521 | 530 | class UpgradeDb(command.Command): |
@@ -23,7 +23,8 b' log = logging.getLogger(__name__)' | |||
|
23 | 23 | |
|
24 | 24 | import pylons.test |
|
25 | 25 | |
|
26 |
__all__ = ['environ', 'url', 'TestController' |
|
|
26 | __all__ = ['environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO', | |
|
27 | 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', ] | |
|
27 | 28 | |
|
28 | 29 | # Invoke websetup with the current config file |
|
29 | 30 | #SetupCommand('setup-app').run([config_file]) |
@@ -33,15 +34,28 b' import pylons.test' | |||
|
33 | 34 | |
|
34 | 35 | environ = {} |
|
35 | 36 | |
|
37 | #SOME GLOBALS FOR TESTS | |
|
38 | TESTS_TMP_PATH = '/tmp' | |
|
39 | ||
|
40 | HG_REPO = 'vcs_test_hg' | |
|
41 | GIT_REPO = 'vcs_test_git' | |
|
42 | ||
|
43 | NEW_HG_REPO = 'vcs_test_hg_new' | |
|
44 | NEW_GIT_REPO = 'vcs_test_git_new' | |
|
45 | ||
|
46 | HG_FORK = 'vcs_test_hg_fork' | |
|
47 | GIT_FORK = 'vcs_test_git_fork' | |
|
48 | ||
|
36 | 49 | class TestController(TestCase): |
|
37 | 50 | |
|
38 | 51 | def __init__(self, *args, **kwargs): |
|
39 | 52 | wsgiapp = pylons.test.pylonsapp |
|
40 | 53 | config = wsgiapp.config |
|
54 | ||
|
41 | 55 | self.app = TestApp(wsgiapp) |
|
42 | 56 | url._push_object(URLGenerator(config['routes.map'], environ)) |
|
43 | 57 | self.sa = meta.Session |
|
44 | ||
|
58 | self.index_location = config['app_conf']['index_dir'] | |
|
45 | 59 | TestCase.__init__(self, *args, **kwargs) |
|
46 | 60 | |
|
47 | 61 | def log_user(self, username='test_admin', password='test12'): |
@@ -4,5 +4,15 b' class TestBranchesController(TestControl' | |||
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | 6 | self.log_user() |
|
7 |
response = self.app.get(url(controller='branches', action='index',repo_name= |
|
|
7 | response = self.app.get(url(controller='branches', action='index', repo_name=HG_REPO)) | |
|
8 | ||
|
9 | assert """<a href="/%s/changeset/27cd5cce30c96924232dffcd24178a07ffeb5dfc">default</a>""" % HG_REPO in response.body, 'wrong info about default branch' | |
|
10 | assert """<a href="/%s/changeset/97e8b885c04894463c51898e14387d80c30ed1ee">git</a>""" % HG_REPO in response.body, 'wrong info about default git' | |
|
11 | assert """<a href="/%s/changeset/2e6a2bf9356ca56df08807f4ad86d480da72a8f4">web</a>""" % HG_REPO in response.body, 'wrong info about default web' | |
|
12 | ||
|
13 | ||
|
14 | ||
|
15 | ||
|
16 | ||
|
17 | ||
|
8 | 18 | # Test response... |
@@ -2,30 +2,35 b' from rhodecode.tests import *' | |||
|
2 | 2 | |
|
3 | 3 | class TestChangelogController(TestController): |
|
4 | 4 | |
|
5 | def test_index(self): | |
|
5 | def test_index_hg(self): | |
|
6 | 6 | self.log_user() |
|
7 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
7 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO)) | |
|
8 | 8 | |
|
9 | print response | |
|
10 | 9 | assert """<div id="chg_20" class="container">""" in response.body, 'wrong info about number ofchanges' |
|
11 | 10 | assert """Small update at simplevcs app""" in response.body, 'missing info about commit message' |
|
12 | assert """<span class="removed" title="removed">0</span>""" in response.body, 'wrong info about removed nodes' | |
|
13 | assert """<span class="changed" title="changed">2</span>""" in response.body, 'wrong info about changed nodes' | |
|
14 | assert """<span class="added" title="added">1</span>""" in response.body, 'wrong info about added nodes' | |
|
11 | assert """<span class="removed" title="removed: ">0</span>""" in response.body, 'wrong info about removed nodes' | |
|
12 | assert """<span class="changed" title="changed: hg.py | models.py">2</span>""" in response.body, 'wrong info about changed nodes' | |
|
13 | assert """<span class="added" title="added: managers.py">1</span>""" in response.body, 'wrong info about added nodes' | |
|
15 | 14 | |
|
16 | 15 | #pagination |
|
17 | 16 | |
|
18 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
19 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
20 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
21 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
22 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
23 |
response = self.app.get(url(controller='changelog', action='index', repo_name= |
|
|
17 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':1}) | |
|
18 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':2}) | |
|
19 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':3}) | |
|
20 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':4}) | |
|
21 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':5}) | |
|
22 | response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':6}) | |
|
23 | ||
|
24 | 24 | # Test response after pagination... |
|
25 | 25 | |
|
26 | assert """<span class="removed" title="removed">20</span>"""in response.body, 'wrong info about number of removed' | |
|
27 | assert """<span class="changed" title="changed">1</span>"""in response.body, 'wrong info about number of changes' | |
|
28 | assert """<span class="added" title="added">0</span>"""in response.body, 'wrong info about number of added' | |
|
29 | 26 | assert """<div class="date">commit 64: 46ad32a4f974@2010-04-20 00:33:21</div>"""in response.body, 'wrong info about commit 64' |
|
30 | assert """<div class="message"><a href="/vcs_test/changeset/46ad32a4f974">Merge with 2e6a2bf9356ca56df08807f4ad86d480da72a8f4</a></div>"""in response.body, 'wrong info about commit 64 is a merge' | |
|
27 | assert """<span class="removed" title="removed: api.rst">1</span>"""in response.body, 'wrong info about number of removed' | |
|
28 | assert """<span class="changed" title="changed: .hgignore | README.rst | conf.py | index.rst | setup.py | test_hg.py | test_nodes.py | __init__.py | __init__.py | base.py | hg.py | nodes.py | __init__.py">13</span>"""in response.body, 'wrong info about number of changes' | |
|
29 | assert """<span class="added" title="added: hg.rst | index.rst | index.rst | nodes.rst | index.rst | simplevcs.rst | installation.rst | quickstart.rst | setup.cfg | baseui_config.py | web.py | __init__.py | exceptions.py | __init__.py | exceptions.py | middleware.py | models.py | settings.py | utils.py | views.py">20</span>"""in response.body, 'wrong info about number of added' | |
|
30 | assert """<div class="message"><a href="/%s/changeset/46ad32a4f974e45472a898c6b0acb600320579b1">Merge with 2e6a2bf9356ca56df08807f4ad86d480da72a8f4</a></div>""" % HG_REPO in response.body, 'wrong info about commit 64 is a merge' | |
|
31 | 31 | |
|
32 | ||
|
33 | ||
|
34 | #def test_index_git(self): | |
|
35 | # self.log_user() | |
|
36 | # response = self.app.get(url(controller='changelog', action='index', repo_name=GIT_REPO)) |
@@ -4,5 +4,5 b' class TestChangesetController(TestContro' | |||
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | 6 | response = self.app.get(url(controller='changeset', action='index', |
|
7 |
repo_name= |
|
|
7 | repo_name=HG_REPO,revision='tip')) | |
|
8 | 8 | # Test response... |
@@ -5,11 +5,11 b' class TestFeedController(TestController)' | |||
|
5 | 5 | def test_rss(self): |
|
6 | 6 | self.log_user() |
|
7 | 7 | response = self.app.get(url(controller='feed', action='rss', |
|
8 |
repo_name= |
|
|
8 | repo_name=HG_REPO)) | |
|
9 | 9 | # Test response... |
|
10 | 10 | |
|
11 | 11 | def test_atom(self): |
|
12 | 12 | self.log_user() |
|
13 | 13 | response = self.app.get(url(controller='feed', action='atom', |
|
14 |
repo_name= |
|
|
14 | repo_name=HG_REPO)) | |
|
15 | 15 | # Test response... No newline at end of file |
@@ -5,7 +5,7 b' class TestFilesController(TestController' | |||
|
5 | 5 | def test_index(self): |
|
6 | 6 | self.log_user() |
|
7 | 7 | response = self.app.get(url(controller='files', action='index', |
|
8 |
repo_name= |
|
|
8 | repo_name=HG_REPO, | |
|
9 | 9 | revision='tip', |
|
10 | 10 | f_path='/')) |
|
11 | 11 | # Test response... |
@@ -4,8 +4,8 b' class TestAdminController(TestController' | |||
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | 6 | self.log_user() |
|
7 |
response = self.app.get(url(controller='h |
|
|
7 | response = self.app.get(url(controller='home', action='index')) | |
|
8 | 8 | #if global permission is set |
|
9 | 9 | assert 'ADD NEW REPOSITORY' in response.body, 'Wrong main page' |
|
10 |
assert 'href="/ |
|
|
10 | assert 'href="/%s/summary"' % HG_REPO in response.body, ' mising repository in list' | |
|
11 | 11 | # Test response... |
@@ -17,7 +17,7 b' class TestLoginController(TestController' | |||
|
17 | 17 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status |
|
18 | 18 | assert response.session['rhodecode_user'].username == 'test_admin', 'wrong logged in user' |
|
19 | 19 | response = response.follow() |
|
20 |
assert ' |
|
|
20 | assert '%s repository' % HG_REPO in response.body | |
|
21 | 21 | |
|
22 | 22 | def test_login_regular_ok(self): |
|
23 | 23 | response = self.app.post(url(controller='login', action='index'), |
@@ -27,7 +27,7 b' class TestLoginController(TestController' | |||
|
27 | 27 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status |
|
28 | 28 | assert response.session['rhodecode_user'].username == 'test_regular', 'wrong logged in user' |
|
29 | 29 | response = response.follow() |
|
30 |
assert ' |
|
|
30 | assert '%s repository' % HG_REPO in response.body | |
|
31 | 31 | assert '<a title="Admin" href="/_admin">' not in response.body |
|
32 | 32 | |
|
33 | 33 | def test_login_ok_came_from(self): |
@@ -11,12 +11,41 b' class TestReposController(TestController' | |||
|
11 | 11 | def test_index_as_xml(self): |
|
12 | 12 | response = self.app.get(url('formatted_repos', format='xml')) |
|
13 | 13 | |
|
14 | def test_create(self): | |
|
14 | def test_create_hg(self): | |
|
15 | 15 | self.log_user() |
|
16 |
repo_name = |
|
|
16 | repo_name = NEW_HG_REPO | |
|
17 | 17 | description = 'description for newly created repo' |
|
18 | 18 | private = False |
|
19 | 19 | response = self.app.post(url('repos'), {'repo_name':repo_name, |
|
20 | 'repo_type':'hg', | |
|
21 | 'description':description, | |
|
22 | 'private':private}) | |
|
23 | ||
|
24 | print response | |
|
25 | ||
|
26 | #test if we have a message for that repository | |
|
27 | print '-' * 100 | |
|
28 | print response.session | |
|
29 | assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo' | |
|
30 | ||
|
31 | #test if the fork was created in the database | |
|
32 | new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one() | |
|
33 | ||
|
34 | assert new_repo.repo_name == repo_name, 'wrong name of repo name in db' | |
|
35 | assert new_repo.description == description, 'wrong description' | |
|
36 | ||
|
37 | #test if repository is visible in the list ? | |
|
38 | response = response.follow() | |
|
39 | ||
|
40 | assert repo_name in response.body, 'missing new repo from the main repos list' | |
|
41 | ||
|
42 | def test_create_git(self): | |
|
43 | self.log_user() | |
|
44 | repo_name = NEW_GIT_REPO | |
|
45 | description = 'description for newly created repo' | |
|
46 | private = False | |
|
47 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |
|
48 | 'repo_type':'git', | |
|
20 | 49 | 'description':description, |
|
21 | 50 | 'private':private}) |
|
22 | 51 | |
@@ -39,8 +68,6 b' class TestReposController(TestController' | |||
|
39 | 68 | assert repo_name in response.body, 'missing new repo from the main repos list' |
|
40 | 69 | |
|
41 | 70 | |
|
42 | ||
|
43 | ||
|
44 | 71 | def test_new(self): |
|
45 | 72 | self.log_user() |
|
46 | 73 | response = self.app.get(url('new_repo')) |
@@ -49,10 +76,10 b' class TestReposController(TestController' | |||
|
49 | 76 | response = self.app.get(url('formatted_new_repo', format='xml')) |
|
50 | 77 | |
|
51 | 78 | def test_update(self): |
|
52 |
response = self.app.put(url('repo', repo_name= |
|
|
79 | response = self.app.put(url('repo', repo_name=HG_REPO)) | |
|
53 | 80 | |
|
54 | 81 | def test_update_browser_fakeout(self): |
|
55 |
response = self.app.post(url('repo', repo_name= |
|
|
82 | response = self.app.post(url('repo', repo_name=HG_REPO), params=dict(_method='put')) | |
|
56 | 83 | |
|
57 | 84 | def test_delete(self): |
|
58 | 85 | self.log_user() |
@@ -60,6 +87,7 b' class TestReposController(TestController' | |||
|
60 | 87 | description = 'description for newly created repo' |
|
61 | 88 | private = False |
|
62 | 89 | response = self.app.post(url('repos'), {'repo_name':repo_name, |
|
90 | 'repo_type':'hg', | |
|
63 | 91 | 'description':description, |
|
64 | 92 | 'private':private}) |
|
65 | 93 | |
@@ -97,17 +125,17 b' class TestReposController(TestController' | |||
|
97 | 125 | |
|
98 | 126 | |
|
99 | 127 | def test_delete_browser_fakeout(self): |
|
100 |
response = self.app.post(url('repo', repo_name= |
|
|
128 | response = self.app.post(url('repo', repo_name=HG_REPO), params=dict(_method='delete')) | |
|
101 | 129 | |
|
102 | 130 | def test_show(self): |
|
103 | 131 | self.log_user() |
|
104 |
response = self.app.get(url('repo', repo_name= |
|
|
132 | response = self.app.get(url('repo', repo_name=HG_REPO)) | |
|
105 | 133 | |
|
106 | 134 | def test_show_as_xml(self): |
|
107 |
response = self.app.get(url('formatted_repo', repo_name= |
|
|
135 | response = self.app.get(url('formatted_repo', repo_name=HG_REPO, format='xml')) | |
|
108 | 136 | |
|
109 | 137 | def test_edit(self): |
|
110 |
response = self.app.get(url('edit_repo', repo_name= |
|
|
138 | response = self.app.get(url('edit_repo', repo_name=HG_REPO)) | |
|
111 | 139 | |
|
112 | 140 | def test_edit_as_xml(self): |
|
113 |
response = self.app.get(url('formatted_edit_repo', repo_name= |
|
|
141 | response = self.app.get(url('formatted_edit_repo', repo_name=HG_REPO, format='xml')) |
@@ -1,5 +1,4 b'' | |||
|
1 | 1 | from rhodecode.tests import * |
|
2 | from rhodecode.lib.indexers import IDX_LOCATION | |
|
3 | 2 | import os |
|
4 | 3 | from nose.plugins.skip import SkipTest |
|
5 | 4 | |
@@ -13,12 +12,11 b' class TestSearchController(TestControlle' | |||
|
13 | 12 | # Test response... |
|
14 | 13 | |
|
15 | 14 | def test_empty_search(self): |
|
16 | ||
|
17 | if os.path.isdir(IDX_LOCATION): | |
|
15 | if os.path.isdir(self.index_location): | |
|
18 | 16 | raise SkipTest('skipped due to existing index') |
|
19 | 17 | else: |
|
20 | 18 | self.log_user() |
|
21 |
response = self.app.get(url(controller='search', action='index'), {'q': |
|
|
19 | response = self.app.get(url(controller='search', action='index'), {'q':HG_REPO}) | |
|
22 | 20 | assert 'There is no index to search in. Please run whoosh indexer' in response.body, 'No error message about empty index' |
|
23 | 21 | |
|
24 | 22 | def test_normal_search(self): |
@@ -31,7 +29,7 b' class TestSearchController(TestControlle' | |||
|
31 | 29 | |
|
32 | 30 | def test_repo_search(self): |
|
33 | 31 | self.log_user() |
|
34 |
response = self.app.get(url(controller='search', action='index'), {'q':'repository: |
|
|
32 | response = self.app.get(url(controller='search', action='index'), {'q':'repository:%s def test' % HG_REPO}) | |
|
35 | 33 | print response.body |
|
36 | 34 | assert '4 results' in response.body, 'no message about proper search results' |
|
37 | 35 | assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' |
@@ -6,29 +6,27 b' class TestSettingsController(TestControl' | |||
|
6 | 6 | def test_index(self): |
|
7 | 7 | self.log_user() |
|
8 | 8 | response = self.app.get(url(controller='settings', action='index', |
|
9 |
repo_name= |
|
|
9 | repo_name=HG_REPO)) | |
|
10 | 10 | # Test response... |
|
11 | 11 | |
|
12 | 12 | def test_fork(self): |
|
13 | 13 | self.log_user() |
|
14 | 14 | response = self.app.get(url(controller='settings', action='fork', |
|
15 |
repo_name= |
|
|
15 | repo_name=HG_REPO)) | |
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | def test_fork_create(self): |
|
19 | 19 | self.log_user() |
|
20 |
fork_name = |
|
|
20 | fork_name = HG_FORK | |
|
21 | 21 | description = 'fork of vcs test' |
|
22 |
repo_name = |
|
|
22 | repo_name = HG_REPO | |
|
23 | 23 | response = self.app.post(url(controller='settings', action='fork_create', |
|
24 | 24 | repo_name=repo_name), |
|
25 | 25 | {'fork_name':fork_name, |
|
26 | 'repo_type':'hg', | |
|
26 | 27 | 'description':description, |
|
27 | 28 | 'private':'False'}) |
|
28 | 29 | |
|
29 | ||
|
30 | print response | |
|
31 | ||
|
32 | 30 | #test if we have a message that fork is ok |
|
33 | 31 | assert 'fork %s repository as %s task added' \ |
|
34 | 32 | % (repo_name, fork_name) in response.session['flash'][0], 'No flash message about fork' |
@@ -48,8 +46,5 b' class TestSettingsController(TestControl' | |||
|
48 | 46 | response = self.app.get(url(controller='summary', action='index', |
|
49 | 47 | repo_name=fork_name)) |
|
50 | 48 | |
|
51 | ||
|
52 | print response | |
|
53 | ||
|
54 | 49 | assert 'Fork of %s' % repo_name in response.body, 'no message about that this repo is a fork' |
|
55 | 50 |
@@ -4,5 +4,5 b' class TestShortlogController(TestControl' | |||
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | 6 | self.log_user() |
|
7 |
response = self.app.get(url(controller='shortlog', action='index',repo_name= |
|
|
7 | response = self.app.get(url(controller='shortlog', action='index',repo_name=HG_REPO)) | |
|
8 | 8 | # Test response... |
@@ -4,8 +4,14 b' class TestSummaryController(TestControll' | |||
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | 6 | self.log_user() |
|
7 |
response = self.app.get(url(controller='summary', action='index', repo_name= |
|
|
8 | print response | |
|
9 | assert """<img style="margin-bottom:2px" class="icon" title="public repository" alt="public" src="/images/icons/lock_open.png"/>""" in response.body | |
|
7 | response = self.app.get(url(controller='summary', action='index', repo_name=HG_REPO)) | |
|
8 | ||
|
9 | #repo type | |
|
10 | assert """<img style="margin-bottom:2px" class="icon" title="Mercurial repository" alt="Mercurial repository" src="/images/icons/hgicon.png"/>""" in response.body | |
|
11 | assert """<img style="margin-bottom:2px" class="icon" title="public repository" alt="public repository" src="/images/icons/lock_open.png"/>""" in response.body | |
|
10 | 12 | |
|
11 | # Test response... | |
|
13 | #codes stats | |
|
14 | assert """var data = {"text/x-python": 42, "text/plain": 12};""" in response.body, 'wrong info about % of codes stats' | |
|
15 | ||
|
16 | # clone url... | |
|
17 | assert """<input type="text" id="clone_url" readonly="readonly" value="hg clone http://test_admin@localhost:80/%s" size="70"/>""" % HG_REPO in response.body |
@@ -4,5 +4,10 b' class TestTagsController(TestController)' | |||
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | 6 | self.log_user() |
|
7 |
response = self.app.get(url(controller='tags', action='index',repo_name= |
|
|
7 | response = self.app.get(url(controller='tags', action='index', repo_name=HG_REPO)) | |
|
8 | assert """<a href="/%s/changeset/27cd5cce30c96924232dffcd24178a07ffeb5dfc">tip</a>""" % HG_REPO, 'wrong info about tip tag' | |
|
9 | assert """<a href="/%s/changeset/fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">0.1.4</a>""" % HG_REPO, 'wrong info about 0.1.4 tag' | |
|
10 | assert """<a href="/%s/changeset/17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">0.1.3</a>""" % HG_REPO, 'wrong info about 0.1.3 tag' | |
|
11 | assert """<a href="/%s/changeset/a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">0.1.2</a>""" % HG_REPO, 'wrong info about 0.1.2 tag' | |
|
12 | assert """<a href="/%s/changeset/eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">0.1.1</a>""" % HG_REPO, 'wrong info about 0.1.1 tag' | |
|
8 | 13 | # Test response... |
@@ -10,7 +10,13 b' class TestUsersController(TestController' | |||
|
10 | 10 | response = self.app.get(url('formatted_users', format='xml')) |
|
11 | 11 | |
|
12 | 12 | def test_create(self): |
|
13 | response = self.app.post(url('users')) | |
|
13 | self.log_user() | |
|
14 | # user_name = 'new_user' | |
|
15 | # response = self.app.post(url('users'),{'repo_name':user_name, | |
|
16 | # 'repo_type':'hg', | |
|
17 | # 'description':description, | |
|
18 | # 'private':private}) | |
|
19 | ||
|
14 | 20 | |
|
15 | 21 | def test_new(self): |
|
16 | 22 | response = self.app.get(url('new_user')) |
@@ -43,6 +43,7 b' full_stack = true' | |||
|
43 | 43 | static_files = true |
|
44 | 44 | lang=en |
|
45 | 45 | cache_dir = %(here)s/data |
|
46 | index_dir = /tmp/index | |
|
46 | 47 | |
|
47 | 48 | #################################### |
|
48 | 49 | ### BEAKER CACHE #### |
|
1 | NO CONTENT: file was removed, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now