Mercurial > kallithea
annotate 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 |
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" """ |
b7adbd5456c2
test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
18 """title="Mercurial repository" alt="Mercurial """ |
b7adbd5456c2
test fixes for latest changes
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
19 """repository" src="/images/icons/hgicon.png"/>""" |
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... |
1813
a8c66e870bd0
implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
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/vcs_test_hg"/>""") |
a8c66e870bd0
implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
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/_1"/>""") |
782
51127b2efb33
fixed broken test after latest changes
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
46 |
1813
a8c66e870bd0
implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
47 def test_index_by_id(self): |
a8c66e870bd0
implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
48 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
|
49 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
|
50 response = self.app.get(url(controller='summary', |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1813
diff
changeset
|
51 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
|
52 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
|
53 |
a8c66e870bd0
implements #285: Implemented non changeable urls for clone url, and web views
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
54 #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
|
55 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
|
56 """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
|
57 """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
|
58 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
|
59 """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
|
60 """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
|
61 |
1080
c334e972f459
fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
62 def _enable_stats(self): |
1530
04027bdb876c
Refactoring of model get functions
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
63 r = Repository.get_by_repo_name(HG_REPO) |
1080
c334e972f459
fixed summary tests
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
64 r.enable_statistics = True |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
65 self.Session.add(r) |
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
66 self.Session.commit() |