Changeset - 0765fd5bf668
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 15 years ago 2010-12-21 16:58:22
marcin@python-works.com
tests update
3 files changed with 49 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/journal.py
Show inline comments
 
@@ -67,14 +67,15 @@ class JournalController(BaseController):
 
            .order_by(UserLog.action_date.desc())\
 
            .limit(20)\
 
            .all()
 
        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')
 
            if user_id:
 
                try:
 
                    scm_model.toggle_following_user(user_id,
 
@@ -90,8 +91,8 @@ class JournalController(BaseController):
 
                                                    c.rhodecode_user.user_id)
 
                    return 'ok'
 
                except:
 
                    raise HTTPInternalServerError()
 

	
 

	
 

	
 
        log.debug('token mismatch %s vs %s', cur_token, token)
 
        raise HTTPInternalServerError()
rhodecode/tests/functional/test_home.py
Show inline comments
 
@@ -3,9 +3,13 @@ from rhodecode.tests import *
 
class TestHomeController(TestController):
 

	
 
    def test_index(self):
 
        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'
rhodecode/tests/functional/test_journal.py
Show inline comments
 
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
0 comments (0 inline, 0 general)