comparison rhodecode/tests/functional/test_summary.py @ 2031:82a88013a3fd

merge 1.3 into stable
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 26 Feb 2012 17:25:09 +0200
parents 8c6d62a8467c b7adbd5456c2
children 63e58ef80ef1
comparison
equal deleted inserted replaced
2005:ab0e122b38a7 2031:82a88013a3fd
5 5
6 class TestSummaryController(TestController): 6 class TestSummaryController(TestController):
7 7
8 def test_index(self): 8 def test_index(self):
9 self.log_user() 9 self.log_user()
10 ID = Repository.get_by_repo_name(HG_REPO).repo_id
10 response = self.app.get(url(controller='summary', 11 response = self.app.get(url(controller='summary',
11 action='index', repo_name=HG_REPO)) 12 action='index',
13 repo_name=HG_REPO))
12 14
13 #repo type 15 #repo type
14 self.assertTrue("""<img style="margin-bottom:2px" class="icon" """ 16 response.mustcontain(
15 """title="Mercurial repository" alt="Mercurial """ 17 """<img style="margin-bottom:2px" class="icon" """
16 """repository" src="/images/icons/hgicon.png"/>""" 18 """title="Mercurial repository" alt="Mercurial """
17 in response.body) 19 """repository" src="/images/icons/hgicon.png"/>"""
18 self.assertTrue("""<img style="margin-bottom:2px" class="icon" """ 20 )
19 """title="public repository" alt="public """ 21 response.mustcontain(
20 """repository" src="/images/icons/lock_open.png"/>""" 22 """<img style="margin-bottom:2px" class="icon" """
21 in response.body) 23 """title="public repository" alt="public """
24 """repository" src="/images/icons/lock_open.png"/>"""
25 )
22 26
23 #codes stats 27 #codes stats
24 self._enable_stats() 28 self._enable_stats()
25 29
26 invalidate_cache('get_repo_cached_%s' % HG_REPO) 30 invalidate_cache('get_repo_cached_%s' % HG_REPO)
27 response = self.app.get(url(controller='summary', action='index', 31 response = self.app.get(url(controller='summary', action='index',
28 repo_name=HG_REPO)) 32 repo_name=HG_REPO))
29
30 response.mustcontain( 33 response.mustcontain(
31 """var data = [["py", {"count": 42, "desc": ["Python"]}], """ 34 """var data = [["py", {"count": 42, "desc": ["Python"]}], """
32 """["rst", {"count": 11, "desc": ["Rst"]}], """ 35 """["rst", {"count": 11, "desc": ["Rst"]}], """
33 """["sh", {"count": 2, "desc": ["Bash"]}], """ 36 """["sh", {"count": 2, "desc": ["Bash"]}], """
34 """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}],""" 37 """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}],"""
36 """["css", {"count": 1, "desc": ["Css"]}], """ 39 """["css", {"count": 1, "desc": ["Css"]}], """
37 """["bat", {"count": 1, "desc": ["Batch"]}]];""" 40 """["bat", {"count": 1, "desc": ["Batch"]}]];"""
38 ) 41 )
39 42
40 # clone url... 43 # clone url...
41 response.mustcontain("""<input type="text" id="clone_url" readonly="readonly" value="hg clone http://test_admin@localhost:80/%s" size="70"/>""" % HG_REPO) 44 response.mustcontain("""<input style="width:80%;margin-left:105px" type="text" id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/vcs_test_hg"/>""")
45 response.mustcontain("""<input style="display:none;width:80%;margin-left:105px" type="text" id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_1"/>""")
46
47 def test_index_by_id(self):
48 self.log_user()
49 ID = Repository.get_by_repo_name(HG_REPO).repo_id
50 response = self.app.get(url(controller='summary',
51 action='index',
52 repo_name='_%s' % ID))
53
54 #repo type
55 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
56 """title="Mercurial repository" alt="Mercurial """
57 """repository" src="/images/icons/hgicon.png"/>""")
58 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
59 """title="public repository" alt="public """
60 """repository" src="/images/icons/lock_open.png"/>""")
42 61
43 def _enable_stats(self): 62 def _enable_stats(self):
44 r = Repository.get_by_repo_name(HG_REPO) 63 r = Repository.get_by_repo_name(HG_REPO)
45 r.enable_statistics = True 64 r.enable_statistics = True
46 self.sa.add(r) 65 self.Session.add(r)
47 self.sa.commit() 66 self.Session.commit()