##// END OF EJS Templates
fixed whoosh failure on new repository...
marcink -
r567:80dc0a23 default
parent child Browse files
Show More
@@ -40,7 +40,7 b' from shutil import rmtree'
40 40 from rhodecode.lib.indexers import INDEX_EXTENSIONS, IDX_LOCATION, SCHEMA, IDX_NAME
41 41
42 42 from time import mktime
43 from vcs.exceptions import ChangesetError
43 from vcs.exceptions import ChangesetError, RepositoryError
44 44
45 45 import logging
46 46
@@ -86,6 +86,7 b' class WhooshIndexingDaemon(object):'
86 86 based on repository walk function
87 87 """
88 88 index_paths_ = set()
89 try:
89 90 for topnode, dirs, files in repo.walk('/', 'tip'):
90 91 for f in files:
91 92 index_paths_.add(jn(repo.path, f.path))
@@ -93,6 +94,8 b' class WhooshIndexingDaemon(object):'
93 94 for f in files:
94 95 index_paths_.add(jn(repo.path, f.path))
95 96
97 except RepositoryError:
98 pass
96 99 return index_paths_
97 100
98 101 def get_node(self, repo, path):
@@ -467,8 +467,8 b' def create_test_env(repos_test_path, con'
467 467 log.addHandler(ch)
468 468
469 469 #PART ONE create db
470 log.debug('making test db in %s', repos_test_path)
471 470 dbname = config['sqlalchemy.db1.url'].split('/')[-1]
471 log.debug('making test db %s', dbname)
472 472
473 473 dbmanage = DbManage(log_sql=True, dbname=dbname, root=config['here'],
474 474 tests=True)
@@ -5,4 +5,27 b' class TestChangelogController(TestContro'
5 5 def test_index(self):
6 6 self.log_user()
7 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 47 {'username':'error',
48 48 'password':'test'})
49 49 assert response.status == '200 OK', 'Wrong response from login page'
50
51 assert 'Enter a value 6 characters long or more' in response.body, 'No error password message in response'
50 print response.body
51 assert 'Enter 6 characters or more' in response.body, 'No error password message in response'
52 52
53 53 def test_login_wrong_username_password(self):
54 54 response = self.app.post(url(controller='login', action='index'),
@@ -1,8 +1,10 b''
1 from rhodecode.model.db import Repository
1 2 from rhodecode.tests import *
2 3
3 4 class TestReposController(TestController):
4 5
5 6 def test_index(self):
7 self.log_user()
6 8 response = self.app.get(url('repos'))
7 9 # Test response...
8 10
@@ -10,9 +12,35 b' class TestReposController(TestController'
10 12 response = self.app.get(url('formatted_repos', format='xml'))
11 13
12 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 42 def test_new(self):
43 self.log_user()
16 44 response = self.app.get(url('new_repo'))
17 45
18 46 def test_new_as_xml(self):
@@ -31,6 +59,7 b' class TestReposController(TestController'
31 59 response = self.app.post(url('repo', repo_name='vcs_test'), params=dict(_method='delete'))
32 60
33 61 def test_show(self):
62 self.log_user()
34 63 response = self.app.get(url('repo', repo_name='vcs_test'))
35 64
36 65 def test_show_as_xml(self):
@@ -37,7 +37,7 b' class TestSettingsController(TestControl'
37 37 fork_repo = self.sa.query(Repository).filter(Repository.repo_name == fork_name).one()
38 38
39 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 43 #test if fork is visible in the list ?
@@ -5,4 +5,7 b' class TestSummaryController(TestControll'
5 5 def test_index(self):
6 6 self.log_user()
7 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 11 # Test response...
General Comments 0
You need to be logged in to leave comments. Login now