Mercurial > kallithea
changeset 875:0765fd5bf668 beta
tests update
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 21 Dec 2010 16:58:22 +0100 |
parents | 4bace4aada09 |
children | 92bc5ddbda06 |
files | rhodecode/controllers/journal.py rhodecode/tests/functional/test_home.py rhodecode/tests/functional/test_journal.py |
diffstat | 3 files changed, 49 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/journal.py Tue Dec 21 02:03:58 2010 +0100 +++ b/rhodecode/controllers/journal.py Tue Dec 21 16:58:22 2010 +0100 @@ -70,8 +70,9 @@ return render('/journal.html') def toggle_following(self): - - if request.POST.get('auth_token') == get_token(): + cur_token = request.POST.get('auth_token') + token = get_token() + if cur_token == token: scm_model = ScmModel() user_id = request.POST.get('follows_user_id') @@ -93,5 +94,5 @@ raise HTTPInternalServerError() - + log.debug('token mismatch %s vs %s', cur_token, token) raise HTTPInternalServerError()
--- a/rhodecode/tests/functional/test_home.py Tue Dec 21 02:03:58 2010 +0100 +++ b/rhodecode/tests/functional/test_home.py Tue Dec 21 16:58:22 2010 +0100 @@ -6,6 +6,10 @@ self.log_user() response = self.app.get(url(controller='home', action='index')) #if global permission is set - assert 'ADD NEW REPOSITORY' in response.body, 'Wrong main page' + assert 'ADD NEW REPOSITORY' in response.body, 'No Button for add new repository' assert 'href="/%s/summary"' % HG_REPO in response.body, ' mising repository in list' # Test response... + + assert """<img class="icon" title="Mercurial repository" alt="Mercurial repository" src="/images/icons/hgicon.png"/>""" in response.body, 'wrong info about type of repositry' + assert """<img class="icon" title="public repository" alt="public repository" src="/images/icons/lock_open.png"/>""" in response.body, 'wrong info about repository availabilty' + assert """<a class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232dffcd24178a07ffeb5dfc" tooltip_title="merge">r173:27cd5cce30c9</a>""" in response.body, 'no info about tooltip'
--- a/rhodecode/tests/functional/test_journal.py Tue Dec 21 02:03:58 2010 +0100 +++ b/rhodecode/tests/functional/test_journal.py Tue Dec 21 16:58:22 2010 +0100 @@ -1,7 +1,47 @@ from rhodecode.tests import * +from rhodecode.model.db import UserFollowing, User, Repository +from rhodecode.lib.helpers import get_token class TestJournalController(TestController): def test_index(self): + self.log_user() response = self.app.get(url(controller='journal', action='index')) # Test response... + assert """<div class="currently_following"> + + + <img class="icon" title="public repository" alt="public repository" src="/images/icons/lock_open.png"/> + + <a href="/vcs_test_hg/summary">vcs_test_hg</a> + + </div>""" in response.body, 'following repo list' + + + + def test_stop_following_repository(self): + session = self.log_user() +# usr = self.sa.query(User).filter(User.username == 'test_admin').one() +# repo = self.sa.query(Repository).filter(Repository.repo_name == HG_REPO).one() +# +# followings = self.sa.query(UserFollowing)\ +# .filter(UserFollowing.user == usr)\ +# .filter(UserFollowing.follows_repository == repo).all() +# +# assert len(followings) == 1, 'Not following any repository' +# +# response = self.app.post(url(controller='journal', +# action='toggle_following'), +# {'auth_token':get_token(session), +# 'follows_repo_id':repo.repo_id}) + + def test_start_following_repository(self): + self.log_user() + response = self.app.get(url(controller='journal', action='index'),) + + + def __add_repo(self): + pass + + def __remove_repo(self): + pass