##// END OF EJS Templates
fixed some tests after icon change
marcink -
r4010:f81b1fde default
parent child Browse files
Show More
@@ -1,83 +1,83 b''
1 1 import time
2 2 from rhodecode.tests import *
3 3 from rhodecode.tests.fixture import Fixture
4 4 from rhodecode.model.meta import Session
5 5 from rhodecode.model.db import User, Repository
6 6 from rhodecode.model.repo import RepoModel
7 7 from rhodecode.model.repos_group import ReposGroupModel
8 8
9 9
10 10 fixture = Fixture()
11 11
12 12
13 13 class TestHomeController(TestController):
14 14
15 15 def test_index(self):
16 16 self.log_user()
17 17 response = self.app.get(url(controller='home', action='index'))
18 18 #if global permission is set
19 19 response.mustcontain('Add repository')
20 20 # html in javascript variable:
21 21 response.mustcontain("""var data = {"totalRecords": %s"""
22 22 % len(Repository.getAll()))
23 23 response.mustcontain(r'href=\"/%s\"' % HG_REPO)
24 24
25 25 response.mustcontain(r"""<img class=\"icon\" title=\"Mercurial repository\" """
26 26 r"""alt=\"Mercurial repository\" src=\"/images/icons/hg"""
27 27 r"""icon.png\"/>""")
28 28 response.mustcontain(r"""<img class=\"icon\" title=\"Public repository\" """
29 r"""alt=\"Public repository\" src=\"/images/icons/lock_"""
30 r"""open.png\"/>""")
29 r"""alt=\"Public repository\" src=\"/images/icons/public_"""
30 r"""repo.png\"/>""")
31 31
32 32 response.mustcontain("""fixes issue with having custom format for git-log""")
33 33 response.mustcontain("""/%s/changeset/5f2c6ee195929b0be80749243c18121c9864a3b3""" % GIT_REPO)
34 34
35 35 response.mustcontain("""disable security checks on hg clone for travis""")
36 36 response.mustcontain("""/%s/changeset/96507bd11ecc815ebc6270fdf6db110928c09c1e""" % HG_REPO)
37 37
38 38 def test_repo_summary_with_anonymous_access_disabled(self):
39 39 anon = User.get_default_user()
40 40 anon.active = False
41 41 Session().add(anon)
42 42 Session().commit()
43 43 time.sleep(1.5) # must sleep for cache (1s to expire)
44 44 try:
45 45 response = self.app.get(url(controller='summary',
46 46 action='index', repo_name=HG_REPO),
47 47 status=302)
48 48 assert 'login' in response.location
49 49
50 50 finally:
51 51 anon = User.get_default_user()
52 52 anon.active = True
53 53 Session().add(anon)
54 54 Session().commit()
55 55
56 56 def test_index_with_anonymous_access_disabled(self):
57 57 anon = User.get_default_user()
58 58 anon.active = False
59 59 Session().add(anon)
60 60 Session().commit()
61 61 time.sleep(1.5) # must sleep for cache (1s to expire)
62 62 try:
63 63 response = self.app.get(url(controller='home', action='index'),
64 64 status=302)
65 65 assert 'login' in response.location
66 66 finally:
67 67 anon = User.get_default_user()
68 68 anon.active = True
69 69 Session().add(anon)
70 70 Session().commit()
71 71
72 72 def test_index_page_on_groups(self):
73 73 self.log_user()
74 74 gr = fixture.create_group('gr1')
75 75 fixture.create_repo(name='gr1/repo_in_group', repos_group=gr)
76 76 response = self.app.get(url('repos_group_home', group_name='gr1'))
77 77
78 78 try:
79 79 response.mustcontain("gr1/repo_in_group")
80 80 finally:
81 81 RepoModel().delete('gr1/repo_in_group')
82 82 ReposGroupModel().delete(repos_group='gr1', force_delete=True)
83 83 Session().commit()
@@ -1,125 +1,125 b''
1 1 from rhodecode.tests import *
2 2 from rhodecode.tests.fixture import Fixture
3 3 from rhodecode.model.db import Repository
4 4 from rhodecode.model.repo import RepoModel
5 5 from rhodecode.model.meta import Session
6 6 from rhodecode.model.scm import ScmModel
7 7
8 8 fixture = Fixture()
9 9
10 10
11 11 class TestSummaryController(TestController):
12 12
13 13 def test_index(self):
14 14 self.log_user()
15 15 ID = Repository.get_by_repo_name(HG_REPO).repo_id
16 16 response = self.app.get(url(controller='summary',
17 17 action='index',
18 18 repo_name=HG_REPO))
19 19
20 20 #repo type
21 21 response.mustcontain(
22 22 """<img style="margin-bottom:2px" class="icon" """
23 23 """title="Mercurial repository" alt="Mercurial repository" """
24 24 """src="/images/icons/hgicon.png"/>"""
25 25 )
26 26 response.mustcontain(
27 27 """<img style="margin-bottom:2px" class="icon" """
28 28 """title="Public repository" alt="Public """
29 """repository" src="/images/icons/lock_open.png"/>"""
29 """repository" src="/images/icons/public_repo.png"/>"""
30 30 )
31 31
32 32 #codes stats
33 33 self._enable_stats()
34 34
35 35 ScmModel().mark_for_invalidation(HG_REPO)
36 36 response = self.app.get(url(controller='summary', action='index',
37 37 repo_name=HG_REPO))
38 38 response.mustcontain(
39 39 """var data = [["py", {"count": 68, "desc": ["Python"]}], """
40 40 """["rst", {"count": 16, "desc": ["Rst"]}], """
41 41 """["css", {"count": 2, "desc": ["Css"]}], """
42 42 """["sh", {"count": 2, "desc": ["Bash"]}], """
43 43 """["yml", {"count": 1, "desc": ["Yaml"]}], """
44 44 """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}], """
45 45 """["js", {"count": 1, "desc": ["Javascript"]}], """
46 46 """["cfg", {"count": 1, "desc": ["Ini"]}], """
47 47 """["ini", {"count": 1, "desc": ["Ini"]}], """
48 48 """["html", {"count": 1, "desc": ["EvoqueHtml", "Html"]}]];"""
49 49 )
50 50
51 51 # clone url...
52 52 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % HG_REPO)
53 53 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
54 54
55 55 def test_index_git(self):
56 56 self.log_user()
57 57 ID = Repository.get_by_repo_name(GIT_REPO).repo_id
58 58 response = self.app.get(url(controller='summary',
59 59 action='index',
60 60 repo_name=GIT_REPO))
61 61
62 62 #repo type
63 63 response.mustcontain(
64 64 """<img style="margin-bottom:2px" class="icon" """
65 65 """title="Git repository" alt="Git repository" """
66 66 """src="/images/icons/giticon.png"/>"""
67 67 )
68 68 response.mustcontain(
69 69 """<img style="margin-bottom:2px" class="icon" """
70 70 """title="Public repository" alt="Public """
71 """repository" src="/images/icons/lock_open.png"/>"""
71 """repository" src="/images/icons/public_repo.png"/>"""
72 72 )
73 73
74 74 # clone url...
75 75 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % GIT_REPO)
76 76 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
77 77
78 78 def test_index_by_id_hg(self):
79 79 self.log_user()
80 80 ID = Repository.get_by_repo_name(HG_REPO).repo_id
81 81 response = self.app.get(url(controller='summary',
82 82 action='index',
83 83 repo_name='_%s' % ID))
84 84
85 85 #repo type
86 86 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
87 87 """title="Mercurial repository" alt="Mercurial """
88 88 """repository" src="/images/icons/hgicon.png"/>""")
89 89 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
90 90 """title="Public repository" alt="Public """
91 """repository" src="/images/icons/lock_open.png"/>""")
91 """repository" src="/images/icons/public_repo.png"/>""")
92 92
93 93 def test_index_by_repo_having_id_path_in_name_hg(self):
94 94 self.log_user()
95 95 fixture.create_repo(name='repo_1')
96 96 response = self.app.get(url(controller='summary',
97 97 action='index',
98 98 repo_name='repo_1'))
99 99
100 100 try:
101 101 response.mustcontain("repo_1")
102 102 finally:
103 103 RepoModel().delete(Repository.get_by_repo_name('repo_1'))
104 104 Session().commit()
105 105
106 106 def test_index_by_id_git(self):
107 107 self.log_user()
108 108 ID = Repository.get_by_repo_name(GIT_REPO).repo_id
109 109 response = self.app.get(url(controller='summary',
110 110 action='index',
111 111 repo_name='_%s' % ID))
112 112
113 113 #repo type
114 114 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
115 115 """title="Git repository" alt="Git """
116 116 """repository" src="/images/icons/giticon.png"/>""")
117 117 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
118 118 """title="Public repository" alt="Public """
119 """repository" src="/images/icons/lock_open.png"/>""")
119 """repository" src="/images/icons/public_repo.png"/>""")
120 120
121 121 def _enable_stats(self):
122 122 r = Repository.get_by_repo_name(HG_REPO)
123 123 r.enable_statistics = True
124 124 Session().add(r)
125 125 Session().commit()
General Comments 0
You need to be logged in to leave comments. Login now