annotate kallithea/tests/functional/test_home.py @ 6946:f1acd7c28157

changelog: add more verbose titles to [HG] and [GIT] repotags
author domruf <dominikruf@gmail.com>
date Fri, 13 Oct 2017 20:44:01 +0200
parents e81332582fc9
children 6c3bda995a88
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6217
8d98924c58b1 tests: add as little code as possible in __init__.py
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 6116
diff changeset
1 from kallithea.tests.base import *
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
2 from kallithea.tests.fixture import Fixture
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
3 from kallithea.model.meta import Session
4422
d51a6f5e57d1 cleanup: remove unused Python imports, found with pyflakes
Mads Kiilerich <madski@unity3d.com>
parents: 4187
diff changeset
4 from kallithea.model.db import Repository
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
5 from kallithea.model.repo import RepoModel
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
6 from kallithea.model.repo_group import RepoGroupModel
462
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7
1788
ef0613584ced test fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1481
diff changeset
8
3647
8a86836fad64 more usage of fixture tools
Marcin Kuzminski <marcin@python-works.com>
parents: 3291
diff changeset
9 fixture = Fixture()
8a86836fad64 more usage of fixture tools
Marcin Kuzminski <marcin@python-works.com>
parents: 3291
diff changeset
10
8a86836fad64 more usage of fixture tools
Marcin Kuzminski <marcin@python-works.com>
parents: 3291
diff changeset
11
5922
7f2aa3ec2931 pytest migration: rename TestControllerPytest back to TestController
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5711
diff changeset
12 class TestHomeController(TestController):
462
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 def test_index(self):
464
cbe777be5b8c some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
15 self.log_user()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
16 response = self.app.get(url(controller='home', action='index'))
6864
7691290837d2 codingstyle: trivial whitespace fixes
Lars Kruse <devel@sumpfralle.de>
parents: 6532
diff changeset
17 # if global permission is set
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4010
diff changeset
18 response.mustcontain('Add Repository')
6487
481f64dbe85c tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents: 6220
diff changeset
19
6946
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
20 response.mustcontain(
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
21 """<span class="repotag" title="Git repository">git"""
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
22 )
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
23
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
24 response.mustcontain(
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
25 """<span class="repotag" title="Mercurial repository">hg"""
f1acd7c28157 changelog: add more verbose titles to [HG] and [GIT] repotags
domruf <dominikruf@gmail.com>
parents: 6875
diff changeset
26 )
6487
481f64dbe85c tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents: 6220
diff changeset
27
3752
1e5bb8ed77d6 index: always use lightweight - there shouldn't be any reason not to
Mads Kiilerich <madski@unity3d.com>
parents: 3734
diff changeset
28 # html in javascript variable:
1e5bb8ed77d6 index: always use lightweight - there shouldn't be any reason not to
Mads Kiilerich <madski@unity3d.com>
parents: 3734
diff changeset
29 response.mustcontain(r'href=\"/%s\"' % HG_REPO)
875
0765fd5bf668 tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
30
6532
33b71a130b16 templates: properly escape inline JavaScript values
Søren Løvborg <sorenl@unity3d.com>
parents: 6487
diff changeset
31 response.mustcontain(r'\x3ci class=\"icon-globe\"')
1788
ef0613584ced test fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1481
diff changeset
32
6487
481f64dbe85c tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents: 6220
diff changeset
33 response.mustcontain(r'\"fixes issue with having custom format for git-log\n\"')
481f64dbe85c tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents: 6220
diff changeset
34 response.mustcontain(r'\"/%s/changeset/5f2c6ee195929b0be80749243c18121c9864a3b3\"' % GIT_REPO)
3797
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3752
diff changeset
35
6487
481f64dbe85c tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents: 6220
diff changeset
36 response.mustcontain(r'\"disable security checks on hg clone for travis\"')
481f64dbe85c tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents: 6220
diff changeset
37 response.mustcontain(r'\"/%s/changeset/96507bd11ecc815ebc6270fdf6db110928c09c1e\"' % HG_REPO)
2714
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
38
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
39 def test_repo_summary_with_anonymous_access_disabled(self):
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4010
diff changeset
40 with fixture.anon_access(False):
2714
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
41 response = self.app.get(url(controller='summary',
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
42 action='index', repo_name=HG_REPO),
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
43 status=302)
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
44 assert 'login' in response.location
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
45
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
46 def test_index_with_anonymous_access_disabled(self):
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4010
diff changeset
47 with fixture.anon_access(False):
2714
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
48 response = self.app.get(url(controller='home', action='index'),
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
49 status=302)
a2eaa0054430 fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents: 2427
diff changeset
50 assert 'login' in response.location
2946
dbb311201ce3 add test for enabling lightweight dashboard
Marcin Kuzminski <marcin@python-works.com>
parents: 2714
diff changeset
51
3167
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 2973
diff changeset
52 def test_index_page_on_groups(self):
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 2973
diff changeset
53 self.log_user()
5631
bd4840ad72d3 tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents: 4839
diff changeset
54 gr = fixture.create_repo_group(u'gr1')
bd4840ad72d3 tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents: 4839
diff changeset
55 fixture.create_repo(name=u'gr1/repo_in_group', repo_group=gr)
bd4840ad72d3 tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents: 4839
diff changeset
56 response = self.app.get(url('repos_group_home', group_name=u'gr1'))
3167
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 2973
diff changeset
57
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 2973
diff changeset
58 try:
5631
bd4840ad72d3 tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents: 4839
diff changeset
59 response.mustcontain(u"gr1/repo_in_group")
3167
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 2973
diff changeset
60 finally:
5631
bd4840ad72d3 tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents: 4839
diff changeset
61 RepoModel().delete(u'gr1/repo_in_group')
bd4840ad72d3 tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents: 4839
diff changeset
62 RepoGroupModel().delete(repo_group=u'gr1', force_delete=True)
3167
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 2973
diff changeset
63 Session().commit()