test_journal.py
44 lines
| 1.8 KiB
| text/x-python
|
PythonLexer
r734 | from rhodecode.tests import * | |||
r875 | from rhodecode.model.db import UserFollowing, User, Repository | |||
from rhodecode.lib.helpers import get_token | ||||
r1021 | import datetime | |||
r734 | ||||
r3075 | ||||
r734 | class TestJournalController(TestController): | |||
def test_index(self): | ||||
r875 | self.log_user() | |||
r734 | response = self.app.get(url(controller='journal', action='index')) | |||
r1021 | ||||
r734 | # Test response... | |||
r1021 | assert """ <span id="follow_toggle_1" class="following" title="Stop following this repository""" in response.body, 'no info about stop follwoing repo id 1' | |||
r875 | ||||
r1021 | assert """<div class="journal_day">%s</div>""" % datetime.date.today() in response.body, 'no info about action journal day' | |||
r875 | ||||
def test_stop_following_repository(self): | ||||
session = self.log_user() | ||||
r1749 | # usr = self.Session.query(User).filter(User.username == 'test_admin').one() | |||
# repo = self.Session.query(Repository).filter(Repository.repo_name == HG_REPO).one() | ||||
r875 | # | |||
r1749 | # followings = self.Session.query(UserFollowing)\ | |||
r875 | # .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'),) | ||||
r3075 | def test_public_journal_atom(self): | |||
self.log_user() | ||||
response = self.app.get(url(controller='journal', action='public_journal_atom'),) | ||||
r875 | ||||
r3075 | def test_public_journal_rss(self): | |||
self.log_user() | ||||
response = self.app.get(url(controller='journal', action='public_journal_rss'),) | ||||