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