annotate rhodecode/tests/functional/test_summary.py @ 3550:7abbb77b02d0 beta

Repo size - show just the size without duplicating text bring back numeric revision into changelog Fixed tests
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 20 Mar 2013 16:21:34 +0100
parents f4ce9416cbd5
children 8a86836fad64
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
2822
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
4 from rhodecode.model.repo import RepoModel
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
5 from rhodecode.tests.models.common import _make_repo
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
6 from rhodecode.model.meta import Session
82
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
7
1813
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
8
82
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
9 class TestSummaryController(TestController):
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
10
670713507d03 Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
11 def test_index(self):
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
12 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
13 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
14 response = self.app.get(url(controller='summary',
1818
cf51bbfb120e auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents: 1813
diff changeset
15 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
16 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
17
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
18 #repo type
1895
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
19 response.mustcontain(
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
20 """<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
21 """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
22 """src="/images/icons/hgicon.png"/>"""
1895
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
23 )
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
24 response.mustcontain(
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
25 """<img style="margin-bottom:2px" class="icon" """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
26 """title="public repository" alt="public """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
27 """repository" src="/images/icons/lock_open.png"/>"""
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
28 )
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
29
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
30 #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
31 self._enable_stats()
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
32
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
33 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
34 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
35 repo_name=HG_REPO))
1895
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
36 response.mustcontain(
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
37 """var data = [["py", {"count": 42, "desc": ["Python"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
38 """["rst", {"count": 11, "desc": ["Rst"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
39 """["sh", {"count": 2, "desc": ["Bash"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
40 """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}],"""
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
41 """ ["cfg", {"count": 1, "desc": ["Ini"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
42 """["css", {"count": 1, "desc": ["Css"]}], """
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
43 """["bat", {"count": 1, "desc": ["Batch"]}]];"""
b7adbd5456c2 test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
44 )
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
45
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
46 # clone url...
3291
f4ce9416cbd5 fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 2822
diff changeset
47 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % HG_REPO)
f4ce9416cbd5 fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 2822
diff changeset
48 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
49
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
50 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
51 self.log_user()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
52 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
53 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
54 action='index',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
55 repo_name=GIT_REPO))
782
51127b2efb33 fixed broken test after latest changes
Marcin Kuzminski <marcin@python-works.com>
parents: 688
diff changeset
56
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
57 #repo type
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
58 response.mustcontain(
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
59 """<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
60 """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
61 """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
62 )
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
63 response.mustcontain(
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
64 """<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
65 """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
66 """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
67 )
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
68
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
69 # clone url...
3291
f4ce9416cbd5 fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 2822
diff changeset
70 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % GIT_REPO)
f4ce9416cbd5 fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 2822
diff changeset
71 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
72
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
73 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
74 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
75 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
76 response = self.app.get(url(controller='summary',
1818
cf51bbfb120e auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents: 1813
diff changeset
77 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
78 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
79
a8c66e870bd0 implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
80 #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
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="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
83 """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
84 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
85 """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
86 """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
87
2822
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
88 def test_index_by_repo_having_id_path_in_name_hg(self):
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
89 self.log_user()
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
90 _make_repo(name='repo_1')
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
91 Session().commit()
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
92 response = self.app.get(url(controller='summary',
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
93 action='index',
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
94 repo_name='repo_1'))
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
95
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
96 try:
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
97 response.mustcontain("""repo_1""")
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
98 finally:
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
99 RepoModel().delete(Repository.get_by_repo_name('repo_1'))
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
100 Session().commit()
1670ee0aded7 fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
101
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
102 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
103 self.log_user()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
104 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
105 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
106 action='index',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
107 repo_name='_%s' % ID))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
108
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
109 #repo type
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1895
diff changeset
110 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
111 """title="Git repository" alt="Git """
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
112 """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
113 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
114 """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
115 """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
116
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
117 def _enable_stats(self):
1530
04027bdb876c Refactoring of model get functions
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
118 r = Repository.get_by_repo_name(HG_REPO)
1080
c334e972f459 fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents: 782
diff changeset
119 r.enable_statistics = True
1749
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
120 self.Session.add(r)
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
121 self.Session.commit()