# HG changeset patch # User Marcin Kuzminski # Date 2010-12-21 15:58:22 # Node ID 0765fd5bf6682ad14692ff0921f4a8f2e0f26b86 # Parent 4bace4aada0969b77f00328bd358f4f7cef8fd84 tests update diff --git a/rhodecode/controllers/journal.py b/rhodecode/controllers/journal.py --- a/rhodecode/controllers/journal.py +++ b/rhodecode/controllers/journal.py @@ -70,8 +70,9 @@ class JournalController(BaseController): 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 @@ class JournalController(BaseController): raise HTTPInternalServerError() - + log.debug('token mismatch %s vs %s', cur_token, token) raise HTTPInternalServerError() diff --git a/rhodecode/tests/functional/test_home.py b/rhodecode/tests/functional/test_home.py --- a/rhodecode/tests/functional/test_home.py +++ b/rhodecode/tests/functional/test_home.py @@ -6,6 +6,10 @@ class TestHomeController(TestController) 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 """Mercurial repository""" in response.body, 'wrong info about type of repositry' + assert """public repository""" in response.body, 'wrong info about repository availabilty' + assert """r173:27cd5cce30c9""" in response.body, 'no info about tooltip' diff --git a/rhodecode/tests/functional/test_journal.py b/rhodecode/tests/functional/test_journal.py --- a/rhodecode/tests/functional/test_journal.py +++ b/rhodecode/tests/functional/test_journal.py @@ -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 """
+ + + public repository + + vcs_test_hg + +
""" 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