annotate rhodecode/tests/functional/test_journal.py @ 3141:a45191e7c7bb beta

access control: fix owner checks - they were always true The lambda expressions seems to be left over from something else. They were no longer executed and thus always evaluated to true. Some of the functions also failed if they were executed.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 02 Jan 2013 13:56:44 +0100
parents 25029d6f4b47
children 4910b2607a29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
734
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 from rhodecode.tests import *
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
2 from rhodecode.model.db import UserFollowing, User, Repository
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
3 from rhodecode.lib.helpers import get_token
1021
0ea8eca2d63e fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 875
diff changeset
4 import datetime
734
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5
3075
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
6
734
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 class TestJournalController(TestController):
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 def test_index(self):
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
10 self.log_user()
734
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 response = self.app.get(url(controller='journal', action='index'))
1021
0ea8eca2d63e fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 875
diff changeset
12
734
49eb69d78988 implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 # Test response...
1021
0ea8eca2d63e fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 875
diff changeset
14 assert """ <span id="follow_toggle_1" class="following" title="Stop following this repository""" in response.body, 'no info about stop follwoing repo id 1'
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
15
1021
0ea8eca2d63e fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 875
diff changeset
16 assert """<div class="journal_day">%s</div>""" % datetime.date.today() in response.body, 'no info about action journal day'
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
17
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
18 def test_stop_following_repository(self):
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
19 session = self.log_user()
1749
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
20 # usr = self.Session.query(User).filter(User.username == 'test_admin').one()
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
21 # repo = self.Session.query(Repository).filter(Repository.repo_name == HG_REPO).one()
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
22 #
1749
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
23 # followings = self.Session.query(UserFollowing)\
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
24 # .filter(UserFollowing.user == usr)\
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
25 # .filter(UserFollowing.follows_repository == repo).all()
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
26 #
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
27 # assert len(followings) == 1, 'Not following any repository'
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
28 #
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
29 # response = self.app.post(url(controller='journal',
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
30 # action='toggle_following'),
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
31 # {'auth_token':get_token(session),
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
32 # 'follows_repo_id':repo.repo_id})
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
33
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
34 def test_start_following_repository(self):
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
35 self.log_user()
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
36 response = self.app.get(url(controller='journal', action='index'),)
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
37
3075
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
38 def test_public_journal_atom(self):
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
39 self.log_user()
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
40 response = self.app.get(url(controller='journal', action='public_journal_atom'),)
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 734
diff changeset
41
3075
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
42 def test_public_journal_rss(self):
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
43 self.log_user()
25029d6f4b47 fixed issue with public journal rss/atom feeds after journal filter implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
44 response = self.app.get(url(controller='journal', action='public_journal_rss'),)