Show More
@@ -40,7 +40,7 b' from shutil import rmtree' | |||||
40 | from rhodecode.lib.indexers import INDEX_EXTENSIONS, IDX_LOCATION, SCHEMA, IDX_NAME |
|
40 | from rhodecode.lib.indexers import INDEX_EXTENSIONS, IDX_LOCATION, SCHEMA, IDX_NAME | |
41 |
|
41 | |||
42 | from time import mktime |
|
42 | from time import mktime | |
43 | from vcs.exceptions import ChangesetError |
|
43 | from vcs.exceptions import ChangesetError, RepositoryError | |
44 |
|
44 | |||
45 | import logging |
|
45 | import logging | |
46 |
|
46 | |||
@@ -86,13 +86,16 b' class WhooshIndexingDaemon(object):' | |||||
86 | based on repository walk function |
|
86 | based on repository walk function | |
87 | """ |
|
87 | """ | |
88 | index_paths_ = set() |
|
88 | index_paths_ = set() | |
89 | for topnode, dirs, files in repo.walk('/', 'tip'): |
|
89 | try: | |
90 | for f in files: |
|
90 | for topnode, dirs, files in repo.walk('/', 'tip'): | |
91 | index_paths_.add(jn(repo.path, f.path)) |
|
|||
92 | for dir in dirs: |
|
|||
93 | for f in files: |
|
91 | for f in files: | |
94 | index_paths_.add(jn(repo.path, f.path)) |
|
92 | index_paths_.add(jn(repo.path, f.path)) | |
95 |
|
93 | for dir in dirs: | ||
|
94 | for f in files: | |||
|
95 | index_paths_.add(jn(repo.path, f.path)) | |||
|
96 | ||||
|
97 | except RepositoryError: | |||
|
98 | pass | |||
96 | return index_paths_ |
|
99 | return index_paths_ | |
97 |
|
100 | |||
98 | def get_node(self, repo, path): |
|
101 | def get_node(self, repo, path): |
@@ -467,8 +467,8 b' def create_test_env(repos_test_path, con' | |||||
467 | log.addHandler(ch) |
|
467 | log.addHandler(ch) | |
468 |
|
468 | |||
469 | #PART ONE create db |
|
469 | #PART ONE create db | |
470 | log.debug('making test db in %s', repos_test_path) |
|
|||
471 | dbname = config['sqlalchemy.db1.url'].split('/')[-1] |
|
470 | dbname = config['sqlalchemy.db1.url'].split('/')[-1] | |
|
471 | log.debug('making test db %s', dbname) | |||
472 |
|
472 | |||
473 | dbmanage = DbManage(log_sql=True, dbname=dbname, root=config['here'], |
|
473 | dbmanage = DbManage(log_sql=True, dbname=dbname, root=config['here'], | |
474 | tests=True) |
|
474 | tests=True) |
@@ -4,5 +4,28 b' class TestChangelogController(TestContro' | |||||
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='changelog', action='index',repo_name='vcs_test')) |
|
7 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test')) | |
8 | # Test response... |
|
8 | ||
|
9 | print response | |||
|
10 | assert """<div id="chg_20" class="container">""" in response.body, 'wrong info about number ofchanges' | |||
|
11 | 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' | |||
|
15 | ||||
|
16 | #pagination | |||
|
17 | ||||
|
18 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test'), {'page':1}) | |||
|
19 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test'), {'page':2}) | |||
|
20 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test'), {'page':3}) | |||
|
21 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test'), {'page':4}) | |||
|
22 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test'), {'page':5}) | |||
|
23 | response = self.app.get(url(controller='changelog', action='index', repo_name='vcs_test'), {'page':6}) | |||
|
24 | # Test response after pagination... | |||
|
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' | |||
|
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' | |||
|
31 |
@@ -47,8 +47,8 b' class TestLoginController(TestController' | |||||
47 | {'username':'error', |
|
47 | {'username':'error', | |
48 | 'password':'test'}) |
|
48 | 'password':'test'}) | |
49 | assert response.status == '200 OK', 'Wrong response from login page' |
|
49 | assert response.status == '200 OK', 'Wrong response from login page' | |
50 |
|
50 | print response.body | ||
51 |
assert 'Enter |
|
51 | assert 'Enter 6 characters or more' in response.body, 'No error password message in response' | |
52 |
|
52 | |||
53 | def test_login_wrong_username_password(self): |
|
53 | def test_login_wrong_username_password(self): | |
54 | response = self.app.post(url(controller='login', action='index'), |
|
54 | response = self.app.post(url(controller='login', action='index'), |
@@ -1,8 +1,10 b'' | |||||
|
1 | from rhodecode.model.db import Repository | |||
1 | from rhodecode.tests import * |
|
2 | from rhodecode.tests import * | |
2 |
|
3 | |||
3 | class TestReposController(TestController): |
|
4 | class TestReposController(TestController): | |
4 |
|
5 | |||
5 | def test_index(self): |
|
6 | def test_index(self): | |
|
7 | self.log_user() | |||
6 | response = self.app.get(url('repos')) |
|
8 | response = self.app.get(url('repos')) | |
7 | # Test response... |
|
9 | # Test response... | |
8 |
|
10 | |||
@@ -10,9 +12,35 b' class TestReposController(TestController' | |||||
10 | response = self.app.get(url('formatted_repos', format='xml')) |
|
12 | response = self.app.get(url('formatted_repos', format='xml')) | |
11 |
|
13 | |||
12 | def test_create(self): |
|
14 | def test_create(self): | |
13 | response = self.app.post(url('repos')) |
|
15 | self.log_user() | |
|
16 | repo_name = 'vcs_test_new' | |||
|
17 | description = 'description for newly created repo' | |||
|
18 | private = False | |||
|
19 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |||
|
20 | 'description':description, | |||
|
21 | 'private':private}) | |||
|
22 | ||||
|
23 | print response | |||
|
24 | ||||
|
25 | #test if we have a message that fork is ok | |||
|
26 | assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo' | |||
|
27 | ||||
|
28 | #test if the fork was created in the database | |||
|
29 | new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one() | |||
|
30 | ||||
|
31 | assert new_repo.repo_name == repo_name, 'wrong name of repo name in db' | |||
|
32 | assert new_repo.description == description, 'wrong description' | |||
|
33 | ||||
|
34 | #test if repository is visible in the list ? | |||
|
35 | response = response.follow() | |||
|
36 | ||||
|
37 | assert repo_name in response.body, 'missing new repo from the main repos list' | |||
|
38 | ||||
|
39 | ||||
|
40 | ||||
14 |
|
41 | |||
15 | def test_new(self): |
|
42 | def test_new(self): | |
|
43 | self.log_user() | |||
16 | response = self.app.get(url('new_repo')) |
|
44 | response = self.app.get(url('new_repo')) | |
17 |
|
45 | |||
18 | def test_new_as_xml(self): |
|
46 | def test_new_as_xml(self): | |
@@ -31,6 +59,7 b' class TestReposController(TestController' | |||||
31 | response = self.app.post(url('repo', repo_name='vcs_test'), params=dict(_method='delete')) |
|
59 | response = self.app.post(url('repo', repo_name='vcs_test'), params=dict(_method='delete')) | |
32 |
|
60 | |||
33 | def test_show(self): |
|
61 | def test_show(self): | |
|
62 | self.log_user() | |||
34 | response = self.app.get(url('repo', repo_name='vcs_test')) |
|
63 | response = self.app.get(url('repo', repo_name='vcs_test')) | |
35 |
|
64 | |||
36 | def test_show_as_xml(self): |
|
65 | def test_show_as_xml(self): |
@@ -37,7 +37,7 b' class TestSettingsController(TestControl' | |||||
37 | fork_repo = self.sa.query(Repository).filter(Repository.repo_name == fork_name).one() |
|
37 | fork_repo = self.sa.query(Repository).filter(Repository.repo_name == fork_name).one() | |
38 |
|
38 | |||
39 | assert fork_repo.repo_name == fork_name, 'wrong name of repo name in new db fork repo' |
|
39 | assert fork_repo.repo_name == fork_name, 'wrong name of repo name in new db fork repo' | |
40 | assert fork_repo.fork.repo_name == repo_name, 'wron fork parrent' |
|
40 | assert fork_repo.fork.repo_name == repo_name, 'wrong fork parrent' | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | #test if fork is visible in the list ? |
|
43 | #test if fork is visible in the list ? |
@@ -4,5 +4,8 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='vcs_test')) | |
|
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 | |||
|
10 | ||||
8 | # Test response... |
|
11 | # Test response... |
General Comments 0
You need to be logged in to leave comments.
Login now