##// END OF EJS Templates
added tests for forks and followers pages
marcink -
r1375:f9559677 beta
parent child Browse files
Show More
@@ -0,0 +1,13 b''
1 from rhodecode.tests import *
2
3 class TestFollowersController(TestController):
4
5 def test_index(self):
6 self.log_user()
7 repo_name = HG_REPO
8 response = self.app.get(url(controller='followers',
9 action='followers',
10 repo_name=repo_name))
11
12 self.assertTrue("""test_admin""" in response.body)
13 self.assertTrue("""Started following""" in response.body)
@@ -0,0 +1,41 b''
1 from rhodecode.tests import *
2
3 from rhodecode.model.db import Repository
4
5 class TestForksController(TestController):
6
7 def test_index(self):
8 self.log_user()
9 repo_name = HG_REPO
10 response = self.app.get(url(controller='forks', action='forks',
11 repo_name=repo_name))
12
13 self.assertTrue("""There are no forks yet""" in response.body)
14
15
16 def test_index_with_fork(self):
17 self.log_user()
18
19 # create a fork
20 fork_name = HG_FORK
21 description = 'fork of vcs test'
22 repo_name = HG_REPO
23 response = self.app.post(url(controller='settings',
24 action='fork_create',
25 repo_name=repo_name),
26 {'fork_name':fork_name,
27 'repo_type':'hg',
28 'description':description,
29 'private':'False'})
30
31 response = self.app.get(url(controller='forks', action='forks',
32 repo_name=repo_name))
33
34
35 self.assertTrue("""<a href="/%s/summary">"""
36 """vcs_test_hg_fork</a>""" % fork_name
37 in response.body)
38
39 #remove this fork
40 response = self.app.delete(url('repo', repo_name=fork_name))
41
@@ -44,7 +44,7 b' class FollowersController(BaseRepoContro'
44
44
45 def followers(self, repo_name):
45 def followers(self, repo_name):
46 p = int(request.params.get('page', 1))
46 p = int(request.params.get('page', 1))
47 repo_id = Repository.by_repo_name(repo_name).repo_id
47 repo_id = c.rhodecode_db_repo.repo_id
48 d = UserFollowing.get_repo_followers(repo_id)\
48 d = UserFollowing.get_repo_followers(repo_id)\
49 .order_by(UserFollowing.follows_from)
49 .order_by(UserFollowing.follows_from)
50 c.followers_pager = Page(d, page=p, items_per_page=20)
50 c.followers_pager = Page(d, page=p, items_per_page=20)
@@ -44,7 +44,7 b' class ForksController(BaseRepoController'
44
44
45 def forks(self, repo_name):
45 def forks(self, repo_name):
46 p = int(request.params.get('page', 1))
46 p = int(request.params.get('page', 1))
47 repo_id = Repository.by_repo_name(repo_name).repo_id
47 repo_id = c.rhodecode_db_repo.repo_id
48 d = Repository.get_repo_forks(repo_id)
48 d = Repository.get_repo_forks(repo_id)
49 c.forks_pager = Page(d, page=p, items_per_page=20)
49 c.forks_pager = Page(d, page=p, items_per_page=20)
50
50
General Comments 0
You need to be logged in to leave comments. Login now