annotate rhodecode/tests/functional/test_summary.py @ 2776:63e58ef80ef1

Merge beta branch into stable
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 02 Sep 2012 21:19:54 +0200
parents 82a88013a3fd 9492ab68331f
children f7a52d548fd0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
1 from rhodecode.tests import *
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
2 from rhodecode.model.db import Repository
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
3 from rhodecode.lib.utils import invalidate_cache
82
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
4
1813
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
5
82
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
6 class TestSummaryController(TestController):
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
7
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
8 def test_index(self):
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
9 self.log_user()
1813
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
10 ID = Repository.get_by_repo_name(HG_REPO).repo_id
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
11 response = self.app.get(url(controller='summary',
1818
cf51bbfb120e auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents: 1813
diff changeset
12 action='index',
1813
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
13 repo_name=HG_REPO))
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
14
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
15 #repo type
1895
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
16 response.mustcontain(
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
17 """<img style="margin-bottom:2px" class="icon" """
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
18 """title="Mercurial repository" alt="Mercurial repository" """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
19 """src="/images/icons/hgicon.png"/>"""
1895
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
20 )
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
21 response.mustcontain(
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
22 """<img style="margin-bottom:2px" class="icon" """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
23 """title="public repository" alt="public """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
24 """repository" src="/images/icons/lock_open.png"/>"""
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
25 )
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
26
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
27 #codes stats
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
28 self._enable_stats()
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
29
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
30 invalidate_cache('get_repo_cached_%s' % HG_REPO)
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
31 response = self.app.get(url(controller='summary', action='index',
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
32 repo_name=HG_REPO))
1895
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
33 response.mustcontain(
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
34 """var data = [["py", {"count": 42, "desc": ["Python"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
35 """["rst", {"count": 11, "desc": ["Rst"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
36 """["sh", {"count": 2, "desc": ["Bash"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
37 """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}],"""
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
38 """ ["cfg", {"count": 1, "desc": ["Ini"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
39 """["css", {"count": 1, "desc": ["Css"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
40 """["bat", {"count": 1, "desc": ["Batch"]}]];"""
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
41 )
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
42
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
43 # clone url...
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
44 response.mustcontain("""<input style="width:80%%;margin-left:105px" type="text" id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"/>""" % HG_REPO)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
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/_%s"/>""" % ID)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
46
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
47 def test_index_git(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
48 self.log_user()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
49 ID = Repository.get_by_repo_name(GIT_REPO).repo_id
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
50 response = self.app.get(url(controller='summary',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
51 action='index',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
52 repo_name=GIT_REPO))
782
51127b2efb33 fixed broken test after latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 688
diff changeset
53
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
54 #repo type
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
55 response.mustcontain(
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
56 """<img style="margin-bottom:2px" class="icon" """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
57 """title="Git repository" alt="Git repository" """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
58 """src="/images/icons/giticon.png"/>"""
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
59 )
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
60 response.mustcontain(
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
61 """<img style="margin-bottom:2px" class="icon" """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
62 """title="public repository" alt="public """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
63 """repository" src="/images/icons/lock_open.png"/>"""
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
64 )
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
65
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
66 # clone url...
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
67 response.mustcontain("""<input style="width:80%%;margin-left:105px" type="text" id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"/>""" % GIT_REPO)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
68 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/_%s"/>""" % ID)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
69
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
70 def test_index_by_id_hg(self):
1813
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
71 self.log_user()
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
72 ID = Repository.get_by_repo_name(HG_REPO).repo_id
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
73 response = self.app.get(url(controller='summary',
1818
cf51bbfb120e auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents: 1813
diff changeset
74 action='index',
1813
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
75 repo_name='_%s' % ID))
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
76
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
77 #repo type
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
78 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
79 """title="Mercurial repository" alt="Mercurial """
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
80 """repository" src="/images/icons/hgicon.png"/>""")
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
81 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
82 """title="public repository" alt="public """
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
83 """repository" src="/images/icons/lock_open.png"/>""")
782
51127b2efb33 fixed broken test after latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 688
diff changeset
84
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
85 def test_index_by_id_git(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
86 self.log_user()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
87 ID = Repository.get_by_repo_name(GIT_REPO).repo_id
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
88 response = self.app.get(url(controller='summary',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
89 action='index',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
90 repo_name='_%s' % ID))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
91
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
92 #repo type
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
93 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
94 """title="Git repository" alt="Git """
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
95 """repository" src="/images/icons/giticon.png"/>""")
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
96 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
97 """title="public repository" alt="public """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
98 """repository" src="/images/icons/lock_open.png"/>""")
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
99
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
100 def _enable_stats(self):
1530
04027bdb876c Refactoring of model get functions
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
101 r = Repository.get_by_repo_name(HG_REPO)
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
102 r.enable_statistics = True
1749
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
103 self.Session.add(r)
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
104 self.Session.commit()