Mercurial > kallithea
annotate kallithea/tests/functional/test_home.py @ 6487:481f64dbe85c
tests: tighten TestHomeController matching/description
'<span class="repotag">git' does not actually appear in JS, so move it
above the comment saying so. For the rest, tighten the checks to
actually ensure they match JS, and not e.g. the same text in plain
HTML elsewhere on the page.
author | Søren Løvborg <sorenl@unity3d.com> |
---|---|
date | Fri, 10 Feb 2017 20:30:44 +0100 |
parents | 7bffccee3a49 |
children | 33b71a130b16 |
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 | 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')) |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
462
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 |
481f64dbe85c
tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents:
6220
diff
changeset
|
20 response.mustcontain('<span class="repotag">git') |
481f64dbe85c
tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents:
6220
diff
changeset
|
21 |
3752
1e5bb8ed77d6
index: always use lightweight - there shouldn't be any reason not to
Mads Kiilerich <madski@unity3d.com>
parents:
3734
diff
changeset
|
22 # html in javascript variable: |
6220
7bffccee3a49
db: inline calls to get_all
Søren Løvborg <sorenl@unity3d.com>
parents:
6217
diff
changeset
|
23 response.mustcontain('var data = {"totalRecords": %s' % Repository.query().count()) |
3752
1e5bb8ed77d6
index: always use lightweight - there shouldn't be any reason not to
Mads Kiilerich <madski@unity3d.com>
parents:
3734
diff
changeset
|
24 response.mustcontain(r'href=\"/%s\"' % HG_REPO) |
875 | 25 |
4602
961ef96fcc65
icon-lock-open-alt: use icon-globe to signify public repo
Sean Farley <sean.michael.farley@gmail.com>
parents:
4601
diff
changeset
|
26 response.mustcontain(r'<i class=\"icon-globe\"') |
1788 | 27 |
6487
481f64dbe85c
tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents:
6220
diff
changeset
|
28 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
|
29 response.mustcontain(r'\"/%s/changeset/5f2c6ee195929b0be80749243c18121c9864a3b3\"' % GIT_REPO) |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3752
diff
changeset
|
30 |
6487
481f64dbe85c
tests: tighten TestHomeController matching/description
Søren Løvborg <sorenl@unity3d.com>
parents:
6220
diff
changeset
|
31 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
|
32 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
|
33 |
a2eaa0054430
fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents:
2427
diff
changeset
|
34 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
|
35 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
|
36 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
|
37 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
|
38 status=302) |
a2eaa0054430
fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents:
2427
diff
changeset
|
39 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
|
40 |
a2eaa0054430
fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents:
2427
diff
changeset
|
41 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
|
42 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
|
43 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
|
44 status=302) |
a2eaa0054430
fixed error when disabled anonymous access lead to error on server
Marcin Kuzminski <marcin@python-works.com>
parents:
2427
diff
changeset
|
45 assert 'login' in response.location |
2946
dbb311201ce3
add test for enabling lightweight dashboard
Marcin Kuzminski <marcin@python-works.com>
parents:
2714
diff
changeset
|
46 |
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
|
47 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
|
48 self.log_user() |
5631
bd4840ad72d3
tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents:
4839
diff
changeset
|
49 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
|
50 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
|
51 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
|
52 |
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 try: |
5631
bd4840ad72d3
tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents:
4839
diff
changeset
|
54 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
|
55 finally: |
5631
bd4840ad72d3
tests: more consistently use unicode where unicode is expected
Mads Kiilerich <madski@unity3d.com>
parents:
4839
diff
changeset
|
56 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
|
57 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
|
58 Session().commit() |