##// END OF EJS Templates
small tests improvements
marcink -
r3849:b4fc29a0 beta
parent child Browse files
Show More
@@ -1,160 +1,160 b''
1 import datetime
1 import datetime
2
2
3 from rhodecode.tests import *
3 from rhodecode.tests import *
4 from rhodecode.model.gist import GistModel
4 from rhodecode.model.gist import GistModel
5 from rhodecode.model.meta import Session
5 from rhodecode.model.meta import Session
6 from rhodecode.model.db import User, Gist
6 from rhodecode.model.db import User, Gist
7
7
8
8
9 def _create_gist(f_name, content='some gist', lifetime=-1,
9 def _create_gist(f_name, content='some gist', lifetime=-1,
10 description='gist-desc', gist_type='public',
10 description='gist-desc', gist_type='public',
11 owner=TEST_USER_ADMIN_LOGIN):
11 owner=TEST_USER_ADMIN_LOGIN):
12 gist_mapping = {
12 gist_mapping = {
13 f_name: {'content': content}
13 f_name: {'content': content}
14 }
14 }
15 user = User.get_by_username(owner)
15 user = User.get_by_username(owner)
16 gist = GistModel().create(description, owner=user,
16 gist = GistModel().create(description, owner=user,
17 gist_mapping=gist_mapping, gist_type=gist_type,
17 gist_mapping=gist_mapping, gist_type=gist_type,
18 lifetime=lifetime)
18 lifetime=lifetime)
19 Session().commit()
19 Session().commit()
20 return gist
20 return gist
21
21
22
22
23 class TestGistsController(TestController):
23 class TestGistsController(TestController):
24
24
25 def tearDown(self):
25 def tearDown(self):
26 for g in Gist.get_all():
26 for g in Gist.get_all():
27 GistModel().delete(g)
27 GistModel().delete(g)
28 Session().commit()
28 Session().commit()
29
29
30 def test_index(self):
30 def test_index(self):
31 self.log_user()
31 self.log_user()
32 response = self.app.get(url('gists'))
32 response = self.app.get(url('gists'))
33 # Test response...
33 # Test response...
34 response.mustcontain('There are no gists yet')
34 response.mustcontain('There are no gists yet')
35
35
36 _create_gist('gist1')
36 g1 = _create_gist('gist1').gist_access_id
37 _create_gist('gist2', lifetime=1400)
37 g2 = _create_gist('gist2', lifetime=1400).gist_access_id
38 _create_gist('gist3', description='gist3-desc')
38 g3 = _create_gist('gist3', description='gist3-desc').gist_access_id
39 _create_gist('gist4', gist_type='private')
39 g4 = _create_gist('gist4', gist_type='private').gist_access_id
40 response = self.app.get(url('gists'))
40 response = self.app.get(url('gists'))
41 # Test response...
41 # Test response...
42 response.mustcontain('gist:1')
42 response.mustcontain('gist:%s' % g1)
43 response.mustcontain('gist:2')
43 response.mustcontain('gist:%s' % g2)
44 response.mustcontain('Expires: in 23 hours') # we don't care about the end
44 response.mustcontain('Expires: in 23 hours') # we don't care about the end
45 response.mustcontain('gist:3')
45 response.mustcontain('gist:%s' % g3)
46 response.mustcontain('gist3-desc')
46 response.mustcontain('gist3-desc')
47 response.mustcontain(no=['gist:4'])
47 response.mustcontain(no=['gist:%s' % g4])
48
48
49 def test_index_private_gists(self):
49 def test_index_private_gists(self):
50 self.log_user()
50 self.log_user()
51 gist = _create_gist('gist5', gist_type='private')
51 gist = _create_gist('gist5', gist_type='private')
52 response = self.app.get(url('gists', private=1))
52 response = self.app.get(url('gists', private=1))
53 # Test response...
53 # Test response...
54
54
55 #and privates
55 #and privates
56 response.mustcontain('gist:%s' % gist.gist_access_id)
56 response.mustcontain('gist:%s' % gist.gist_access_id)
57
57
58 def test_create_missing_description(self):
58 def test_create_missing_description(self):
59 self.log_user()
59 self.log_user()
60 response = self.app.post(url('gists'),
60 response = self.app.post(url('gists'),
61 params={'lifetime': -1}, status=200)
61 params={'lifetime': -1}, status=200)
62
62
63 response.mustcontain('Missing value')
63 response.mustcontain('Missing value')
64
64
65 def test_create(self):
65 def test_create(self):
66 self.log_user()
66 self.log_user()
67 response = self.app.post(url('gists'),
67 response = self.app.post(url('gists'),
68 params={'lifetime': -1,
68 params={'lifetime': -1,
69 'content': 'gist test',
69 'content': 'gist test',
70 'filename': 'foo',
70 'filename': 'foo',
71 'public': 'public'},
71 'public': 'public'},
72 status=302)
72 status=302)
73 response = response.follow()
73 response = response.follow()
74 response.mustcontain('added file: foo')
74 response.mustcontain('added file: foo')
75 response.mustcontain('gist test')
75 response.mustcontain('gist test')
76 response.mustcontain('<div class="ui-btn green badge">Public gist</div>')
76 response.mustcontain('<div class="ui-btn green badge">Public gist</div>')
77
77
78 def test_create_with_path_with_dirs(self):
78 def test_create_with_path_with_dirs(self):
79 self.log_user()
79 self.log_user()
80 response = self.app.post(url('gists'),
80 response = self.app.post(url('gists'),
81 params={'lifetime': -1,
81 params={'lifetime': -1,
82 'content': 'gist test',
82 'content': 'gist test',
83 'filename': '/home/foo',
83 'filename': '/home/foo',
84 'public': 'public'},
84 'public': 'public'},
85 status=200)
85 status=200)
86 response.mustcontain('Filename cannot be inside a directory')
86 response.mustcontain('Filename cannot be inside a directory')
87
87
88 def test_access_expired_gist(self):
88 def test_access_expired_gist(self):
89 self.log_user()
89 self.log_user()
90 gist = _create_gist('never-see-me')
90 gist = _create_gist('never-see-me')
91 gist.gist_expires = 0 # 1970
91 gist.gist_expires = 0 # 1970
92 Session().add(gist)
92 Session().add(gist)
93 Session().commit()
93 Session().commit()
94
94
95 response = self.app.get(url('gist', id=gist.gist_access_id), status=404)
95 response = self.app.get(url('gist', id=gist.gist_access_id), status=404)
96
96
97 def test_create_private(self):
97 def test_create_private(self):
98 self.log_user()
98 self.log_user()
99 response = self.app.post(url('gists'),
99 response = self.app.post(url('gists'),
100 params={'lifetime': -1,
100 params={'lifetime': -1,
101 'content': 'private gist test',
101 'content': 'private gist test',
102 'filename': 'private-foo',
102 'filename': 'private-foo',
103 'private': 'private'},
103 'private': 'private'},
104 status=302)
104 status=302)
105 response = response.follow()
105 response = response.follow()
106 response.mustcontain('added file: private-foo<')
106 response.mustcontain('added file: private-foo<')
107 response.mustcontain('private gist test')
107 response.mustcontain('private gist test')
108 response.mustcontain('<div class="ui-btn yellow badge">Private gist</div>')
108 response.mustcontain('<div class="ui-btn yellow badge">Private gist</div>')
109
109
110 def test_create_with_description(self):
110 def test_create_with_description(self):
111 self.log_user()
111 self.log_user()
112 response = self.app.post(url('gists'),
112 response = self.app.post(url('gists'),
113 params={'lifetime': -1,
113 params={'lifetime': -1,
114 'content': 'gist test',
114 'content': 'gist test',
115 'filename': 'foo-desc',
115 'filename': 'foo-desc',
116 'description': 'gist-desc',
116 'description': 'gist-desc',
117 'public': 'public'},
117 'public': 'public'},
118 status=302)
118 status=302)
119 response = response.follow()
119 response = response.follow()
120 response.mustcontain('added file: foo-desc')
120 response.mustcontain('added file: foo-desc')
121 response.mustcontain('gist test')
121 response.mustcontain('gist test')
122 response.mustcontain('gist-desc')
122 response.mustcontain('gist-desc')
123 response.mustcontain('<div class="ui-btn green badge">Public gist</div>')
123 response.mustcontain('<div class="ui-btn green badge">Public gist</div>')
124
124
125 def test_new(self):
125 def test_new(self):
126 self.log_user()
126 self.log_user()
127 response = self.app.get(url('new_gist'))
127 response = self.app.get(url('new_gist'))
128
128
129 def test_update(self):
129 def test_update(self):
130 self.skipTest('not implemented')
130 self.skipTest('not implemented')
131 response = self.app.put(url('gist', id=1))
131 response = self.app.put(url('gist', id=1))
132
132
133 def test_delete(self):
133 def test_delete(self):
134 self.log_user()
134 self.log_user()
135 gist = _create_gist('delete-me')
135 gist = _create_gist('delete-me')
136 response = self.app.delete(url('gist', id=gist.gist_id))
136 response = self.app.delete(url('gist', id=gist.gist_id))
137 self.checkSessionFlash(response, 'Deleted gist %s' % gist.gist_id)
137 self.checkSessionFlash(response, 'Deleted gist %s' % gist.gist_id)
138
138
139 def test_delete_normal_user_his_gist(self):
139 def test_delete_normal_user_his_gist(self):
140 self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
140 self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
141 gist = _create_gist('delete-me', owner=TEST_USER_REGULAR_LOGIN)
141 gist = _create_gist('delete-me', owner=TEST_USER_REGULAR_LOGIN)
142 response = self.app.delete(url('gist', id=gist.gist_id))
142 response = self.app.delete(url('gist', id=gist.gist_id))
143 self.checkSessionFlash(response, 'Deleted gist %s' % gist.gist_id)
143 self.checkSessionFlash(response, 'Deleted gist %s' % gist.gist_id)
144
144
145 def test_delete_normal_user_not_his_own_gist(self):
145 def test_delete_normal_user_not_his_own_gist(self):
146 self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
146 self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
147 gist = _create_gist('delete-me')
147 gist = _create_gist('delete-me')
148 response = self.app.delete(url('gist', id=gist.gist_id), status=403)
148 response = self.app.delete(url('gist', id=gist.gist_id), status=403)
149
149
150 def test_show(self):
150 def test_show(self):
151 gist = _create_gist('gist-show-me')
151 gist = _create_gist('gist-show-me')
152 response = self.app.get(url('gist', id=gist.gist_access_id))
152 response = self.app.get(url('gist', id=gist.gist_access_id))
153 response.mustcontain('added file: gist-show-me<')
153 response.mustcontain('added file: gist-show-me<')
154 response.mustcontain('test_admin (RhodeCode Admin) - created')
154 response.mustcontain('test_admin (RhodeCode Admin) - created')
155 response.mustcontain('gist-desc')
155 response.mustcontain('gist-desc')
156 response.mustcontain('<div class="ui-btn green badge">Public gist</div>')
156 response.mustcontain('<div class="ui-btn green badge">Public gist</div>')
157
157
158 def test_edit(self):
158 def test_edit(self):
159 self.skipTest('not implemented')
159 self.skipTest('not implemented')
160 response = self.app.get(url('edit_gist', id=1))
160 response = self.app.get(url('edit_gist', id=1))
@@ -1,735 +1,735 b''
1 import os
1 import os
2 from rhodecode.tests import *
2 from rhodecode.tests import *
3 from rhodecode.model.db import Repository
3 from rhodecode.model.db import Repository
4 from rhodecode.model.meta import Session
4 from rhodecode.model.meta import Session
5 from rhodecode.tests.fixture import Fixture
5 from rhodecode.tests.fixture import Fixture
6
6
7 fixture = Fixture()
7 fixture = Fixture()
8
8
9 ARCHIVE_SPECS = {
9 ARCHIVE_SPECS = {
10 '.tar.bz2': ('application/x-bzip2', 'tbz2', ''),
10 '.tar.bz2': ('application/x-bzip2', 'tbz2', ''),
11 '.tar.gz': ('application/x-gzip', 'tgz', ''),
11 '.tar.gz': ('application/x-gzip', 'tgz', ''),
12 '.zip': ('application/zip', 'zip', ''),
12 '.zip': ('application/zip', 'zip', ''),
13 }
13 }
14
14
15
15
16 def _set_downloads(repo_name, set_to):
16 def _set_downloads(repo_name, set_to):
17 repo = Repository.get_by_repo_name(repo_name)
17 repo = Repository.get_by_repo_name(repo_name)
18 repo.enable_downloads = set_to
18 repo.enable_downloads = set_to
19 Session().add(repo)
19 Session().add(repo)
20 Session().commit()
20 Session().commit()
21
21
22
22
23 class TestFilesController(TestController):
23 class TestFilesController(TestController):
24
24
25 def test_index(self):
25 def test_index(self):
26 self.log_user()
26 self.log_user()
27 response = self.app.get(url(controller='files', action='index',
27 response = self.app.get(url(controller='files', action='index',
28 repo_name=HG_REPO,
28 repo_name=HG_REPO,
29 revision='tip',
29 revision='tip',
30 f_path='/'))
30 f_path='/'))
31 # Test response...
31 # Test response...
32 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/docs">docs</a>')
32 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/docs">docs</a>')
33 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/vcs">vcs</a>')
33 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/vcs">vcs</a>')
34 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.gitignore">.gitignore</a>')
34 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.gitignore">.gitignore</a>')
35 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgignore">.hgignore</a>')
35 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgignore">.hgignore</a>')
36 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgtags">.hgtags</a>')
36 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgtags">.hgtags</a>')
37 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.travis.yml">.travis.yml</a>')
37 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.travis.yml">.travis.yml</a>')
38 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/MANIFEST.in">MANIFEST.in</a>')
38 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/MANIFEST.in">MANIFEST.in</a>')
39 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/README.rst">README.rst</a>')
39 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/README.rst">README.rst</a>')
40 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/run_test_and_report.sh">run_test_and_report.sh</a>')
40 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/run_test_and_report.sh">run_test_and_report.sh</a>')
41 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.cfg">setup.cfg</a>')
41 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.cfg">setup.cfg</a>')
42 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.py">setup.py</a>')
42 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.py">setup.py</a>')
43 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/test_and_report.sh">test_and_report.sh</a>')
43 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/test_and_report.sh">test_and_report.sh</a>')
44 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/tox.ini">tox.ini</a>')
44 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/tox.ini">tox.ini</a>')
45
45
46 def test_index_revision(self):
46 def test_index_revision(self):
47 self.log_user()
47 self.log_user()
48
48
49 response = self.app.get(
49 response = self.app.get(
50 url(controller='files', action='index',
50 url(controller='files', action='index',
51 repo_name=HG_REPO,
51 repo_name=HG_REPO,
52 revision='7ba66bec8d6dbba14a2155be32408c435c5f4492',
52 revision='7ba66bec8d6dbba14a2155be32408c435c5f4492',
53 f_path='/')
53 f_path='/')
54 )
54 )
55
55
56 #Test response...
56 #Test response...
57
57
58 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>')
58 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>')
59 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>')
59 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>')
60 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>')
60 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>')
61 response.mustcontain('1.1 KiB')
61 response.mustcontain('1.1 KiB')
62 response.mustcontain('text/x-python')
62 response.mustcontain('text/x-python')
63
63
64 def test_index_different_branch(self):
64 def test_index_different_branch(self):
65 self.log_user()
65 self.log_user()
66
66
67 response = self.app.get(url(controller='files', action='index',
67 response = self.app.get(url(controller='files', action='index',
68 repo_name=HG_REPO,
68 repo_name=HG_REPO,
69 revision='97e8b885c04894463c51898e14387d80c30ed1ee',
69 revision='97e8b885c04894463c51898e14387d80c30ed1ee',
70 f_path='/'))
70 f_path='/'))
71
71
72 response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">Branch: git</a></span>""")
72 response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">Branch: git</a></span>""")
73
73
74 def test_index_paging(self):
74 def test_index_paging(self):
75 self.log_user()
75 self.log_user()
76
76
77 for r in [(73, 'a066b25d5df7016b45a41b7e2a78c33b57adc235'),
77 for r in [(73, 'a066b25d5df7016b45a41b7e2a78c33b57adc235'),
78 (92, 'cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e'),
78 (92, 'cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e'),
79 (109, '75feb4c33e81186c87eac740cee2447330288412'),
79 (109, '75feb4c33e81186c87eac740cee2447330288412'),
80 (1, '3d8f361e72ab303da48d799ff1ac40d5ac37c67e'),
80 (1, '3d8f361e72ab303da48d799ff1ac40d5ac37c67e'),
81 (0, 'b986218ba1c9b0d6a259fac9b050b1724ed8e545')]:
81 (0, 'b986218ba1c9b0d6a259fac9b050b1724ed8e545')]:
82
82
83 response = self.app.get(url(controller='files', action='index',
83 response = self.app.get(url(controller='files', action='index',
84 repo_name=HG_REPO,
84 repo_name=HG_REPO,
85 revision=r[1],
85 revision=r[1],
86 f_path='/'))
86 f_path='/'))
87
87
88 response.mustcontain("""@ r%s:%s""" % (r[0], r[1][:12]))
88 response.mustcontain("""@ r%s:%s""" % (r[0], r[1][:12]))
89
89
90 def test_file_source(self):
90 def test_file_source(self):
91 self.log_user()
91 self.log_user()
92 response = self.app.get(url(controller='files', action='index',
92 response = self.app.get(url(controller='files', action='index',
93 repo_name=HG_REPO,
93 repo_name=HG_REPO,
94 revision='8911406ad776fdd3d0b9932a2e89677e57405a48',
94 revision='8911406ad776fdd3d0b9932a2e89677e57405a48',
95 f_path='vcs/nodes.py'))
95 f_path='vcs/nodes.py'))
96
96
97 response.mustcontain("""<div class="commit">Partially implemented <a class="issue-tracker-link" href="https://myissueserver.com/vcs_test_hg/issue/16">#16</a>. filecontent/commit message/author/node name are safe_unicode now.
97 response.mustcontain("""<div class="commit">Partially implemented <a class="issue-tracker-link" href="https://myissueserver.com/vcs_test_hg/issue/16">#16</a>. filecontent/commit message/author/node name are safe_unicode now.
98 In addition some other __str__ are unicode as well
98 In addition some other __str__ are unicode as well
99 Added test for unicode
99 Added test for unicode
100 Improved test to clone into uniq repository.
100 Improved test to clone into uniq repository.
101 removed extra unicode conversion in diff.</div>
101 removed extra unicode conversion in diff.</div>
102 """)
102 """)
103
103
104 response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">Branch: default</a></span>""")
104 response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">Branch: default</a></span>""")
105
105
106 def test_file_source_history(self):
106 def test_file_source_history(self):
107 self.log_user()
107 self.log_user()
108 response = self.app.get(url(controller='files', action='history',
108 response = self.app.get(url(controller='files', action='history',
109 repo_name=HG_REPO,
109 repo_name=HG_REPO,
110 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
110 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
111 f_path='vcs/nodes.py'),
111 f_path='vcs/nodes.py'),
112 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},)
112 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},)
113 #test or history
113 #test or history
114 response.mustcontain("""<optgroup label="Changesets">
114 response.mustcontain("""<optgroup label="Changesets">
115 <option value="dbec37a0d5cab8ff39af4cfc4a4cd3996e4acfc6">r648:dbec37a0d5ca (default)</option>
115 <option value="dbec37a0d5cab8ff39af4cfc4a4cd3996e4acfc6">r648:dbec37a0d5ca (default)</option>
116 <option value="1d20ed9eda9482d46ff0a6af5812550218b3ff15">r639:1d20ed9eda94 (default)</option>
116 <option value="1d20ed9eda9482d46ff0a6af5812550218b3ff15">r639:1d20ed9eda94 (default)</option>
117 <option value="0173395e822797f098799ed95c1a81b6a547a9ad">r547:0173395e8227 (default)</option>
117 <option value="0173395e822797f098799ed95c1a81b6a547a9ad">r547:0173395e8227 (default)</option>
118 <option value="afbb45ade933a8182f1d8ec5d4d1bb2de2572043">r546:afbb45ade933 (default)</option>
118 <option value="afbb45ade933a8182f1d8ec5d4d1bb2de2572043">r546:afbb45ade933 (default)</option>
119 <option value="6f093e30cac34e6b4b11275a9f22f80c5d7ad1f7">r502:6f093e30cac3 (default)</option>
119 <option value="6f093e30cac34e6b4b11275a9f22f80c5d7ad1f7">r502:6f093e30cac3 (default)</option>
120 <option value="c7e2212dd2ae975d1d06534a3d7e317165c06960">r476:c7e2212dd2ae (default)</option>
120 <option value="c7e2212dd2ae975d1d06534a3d7e317165c06960">r476:c7e2212dd2ae (default)</option>
121 <option value="45477506df79f701bf69419aac3e1f0fed3c5bcf">r472:45477506df79 (default)</option>
121 <option value="45477506df79f701bf69419aac3e1f0fed3c5bcf">r472:45477506df79 (default)</option>
122 <option value="5fc76cb25d11e07c60de040f78b8cd265ff10d53">r469:5fc76cb25d11 (default)</option>
122 <option value="5fc76cb25d11e07c60de040f78b8cd265ff10d53">r469:5fc76cb25d11 (default)</option>
123 <option value="b073433cf8994969ee5cd7cce84cbe587bb880b2">r468:b073433cf899 (default)</option>
123 <option value="b073433cf8994969ee5cd7cce84cbe587bb880b2">r468:b073433cf899 (default)</option>
124 <option value="7a74dbfcacd1dbcb58bb9c860b2f29fbb22c4c96">r467:7a74dbfcacd1 (default)</option>
124 <option value="7a74dbfcacd1dbcb58bb9c860b2f29fbb22c4c96">r467:7a74dbfcacd1 (default)</option>
125 <option value="71ee52cc4d629096bdbee036325975dac2af4501">r465:71ee52cc4d62 (default)</option>
125 <option value="71ee52cc4d629096bdbee036325975dac2af4501">r465:71ee52cc4d62 (default)</option>
126 <option value="a5b217d26c5f111e72bae4de672b084ee0fbf75c">r452:a5b217d26c5f (default)</option>
126 <option value="a5b217d26c5f111e72bae4de672b084ee0fbf75c">r452:a5b217d26c5f (default)</option>
127 <option value="47aedd538bf616eedcb0e7d630ea476df0e159c7">r450:47aedd538bf6 (default)</option>
127 <option value="47aedd538bf616eedcb0e7d630ea476df0e159c7">r450:47aedd538bf6 (default)</option>
128 <option value="8e4915fa32d727dcbf09746f637a5f82e539511e">r432:8e4915fa32d7 (default)</option>
128 <option value="8e4915fa32d727dcbf09746f637a5f82e539511e">r432:8e4915fa32d7 (default)</option>
129 <option value="25213a5fbb048dff8ba65d21e466a835536e5b70">r356:25213a5fbb04 (default)</option>
129 <option value="25213a5fbb048dff8ba65d21e466a835536e5b70">r356:25213a5fbb04 (default)</option>
130 <option value="23debcedddc1c23c14be33e713e7786d4a9de471">r351:23debcedddc1 (default)</option>
130 <option value="23debcedddc1c23c14be33e713e7786d4a9de471">r351:23debcedddc1 (default)</option>
131 <option value="61e25b2a90a19e7fffd75dea1e4c7e20df526bbe">r342:61e25b2a90a1 (default)</option>
131 <option value="61e25b2a90a19e7fffd75dea1e4c7e20df526bbe">r342:61e25b2a90a1 (default)</option>
132 <option value="fb95b340e0d03fa51f33c56c991c08077c99303e">r318:fb95b340e0d0 (webvcs)</option>
132 <option value="fb95b340e0d03fa51f33c56c991c08077c99303e">r318:fb95b340e0d0 (webvcs)</option>
133 <option value="bda35e0e564fbbc5cd26fe0a37fb647a254c99fe">r303:bda35e0e564f (default)</option>
133 <option value="bda35e0e564fbbc5cd26fe0a37fb647a254c99fe">r303:bda35e0e564f (default)</option>
134 <option value="97ff74896d7dbf3115a337a421d44b55154acc89">r302:97ff74896d7d (default)</option>
134 <option value="97ff74896d7dbf3115a337a421d44b55154acc89">r302:97ff74896d7d (default)</option>
135 <option value="cec3473c3fdb9599c98067182a075b49bde570f9">r293:cec3473c3fdb (default)</option>
135 <option value="cec3473c3fdb9599c98067182a075b49bde570f9">r293:cec3473c3fdb (default)</option>
136 <option value="0e86c43eef866a013a587666a877c879899599bb">r289:0e86c43eef86 (default)</option>
136 <option value="0e86c43eef866a013a587666a877c879899599bb">r289:0e86c43eef86 (default)</option>
137 <option value="91a27c312808100cf20a602f78befbbff9d89bfd">r288:91a27c312808 (default)</option>
137 <option value="91a27c312808100cf20a602f78befbbff9d89bfd">r288:91a27c312808 (default)</option>
138 <option value="400e36a1670a57d11e3edcb5b07bf82c30006d0b">r287:400e36a1670a (default)</option>
138 <option value="400e36a1670a57d11e3edcb5b07bf82c30006d0b">r287:400e36a1670a (default)</option>
139 <option value="014fb17dfc95b0995e838c565376bf9a993e230a">r261:014fb17dfc95 (default)</option>
139 <option value="014fb17dfc95b0995e838c565376bf9a993e230a">r261:014fb17dfc95 (default)</option>
140 <option value="cca7aebbc4d6125798446b11e69dc8847834a982">r260:cca7aebbc4d6 (default)</option>
140 <option value="cca7aebbc4d6125798446b11e69dc8847834a982">r260:cca7aebbc4d6 (default)</option>
141 <option value="14cdb2957c011a5feba36f50d960d9832ba0f0c1">r258:14cdb2957c01 (workdir)</option>
141 <option value="14cdb2957c011a5feba36f50d960d9832ba0f0c1">r258:14cdb2957c01 (workdir)</option>
142 <option value="34df20118ed74b5987d22a579e8a60e903da5bf8">r245:34df20118ed7 (default)</option>
142 <option value="34df20118ed74b5987d22a579e8a60e903da5bf8">r245:34df20118ed7 (default)</option>
143 <option value="0375d9042a64a1ac1641528f0f0668f9a339e86d">r233:0375d9042a64 (workdir)</option>
143 <option value="0375d9042a64a1ac1641528f0f0668f9a339e86d">r233:0375d9042a64 (workdir)</option>
144 <option value="94aa45fc1806c04d4ba640933edf682c22478453">r222:94aa45fc1806 (workdir)</option>
144 <option value="94aa45fc1806c04d4ba640933edf682c22478453">r222:94aa45fc1806 (workdir)</option>
145 <option value="7ed99bc738818879941e3ce20243f8856a7cfc84">r188:7ed99bc73881 (default)</option>
145 <option value="7ed99bc738818879941e3ce20243f8856a7cfc84">r188:7ed99bc73881 (default)</option>
146 <option value="1e85975528bcebe853732a9e5fb8dbf4461f6bb2">r184:1e85975528bc (default)</option>
146 <option value="1e85975528bcebe853732a9e5fb8dbf4461f6bb2">r184:1e85975528bc (default)</option>
147 <option value="ed30beddde7bbddb26042625be19bcd11576c1dd">r183:ed30beddde7b (default)</option>
147 <option value="ed30beddde7bbddb26042625be19bcd11576c1dd">r183:ed30beddde7b (default)</option>
148 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">r177:a6664e18181c (default)</option>
148 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">r177:a6664e18181c (default)</option>
149 <option value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option>
149 <option value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option>
150 <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35 (default)</option>
150 <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35 (default)</option>
151 <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c (default)</option>
151 <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c (default)</option>
152 <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329 (default)</option>
152 <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329 (default)</option>
153 <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf (git)</option>
153 <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf (git)</option>
154 <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81 (default)</option>
154 <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81 (default)</option>
155 <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc (default)</option>
155 <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc (default)</option>
156 <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21 (default)</option>
156 <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21 (default)</option>
157 <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2 (default)</option>
157 <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2 (default)</option>
158 <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85 (default)</option>
158 <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85 (default)</option>
159 <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2 (git)</option>
159 <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2 (git)</option>
160 <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93 (default)</option>
160 <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93 (default)</option>
161 <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b (default)</option>
161 <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b (default)</option>
162 <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455 (default)</option>
162 <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455 (default)</option>
163 <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32 (default)</option>
163 <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32 (default)</option>
164 <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0 (default)</option>
164 <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0 (default)</option>
165 <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081 (default)</option>
165 <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081 (default)</option>
166 <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad (default)</option>
166 <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad (default)</option>
167 <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7 (default)</option>
167 <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7 (default)</option>
168 <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059 (web)</option>
168 <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059 (web)</option>
169 <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb (web)</option>
169 <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb (web)</option>
170 <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1 (web)</option>
170 <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1 (web)</option>
171 <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71 (web)</option>
171 <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71 (web)</option>
172 <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771 (web)</option>
172 <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771 (web)</option>
173 <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526 (web)</option>
173 <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526 (web)</option>
174 <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4 (web)</option>
174 <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4 (web)</option>
175 <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b (web)</option>
175 <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b (web)</option>
176 <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c (web)</option>
176 <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c (web)</option>
177 <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1 (default)</option>
177 <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1 (default)</option>
178 <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5 (default)</option>
178 <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5 (default)</option>
179 <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283 (default)</option>
179 <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283 (default)</option>
180 <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6 (default)</option>
180 <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6 (default)</option>
181 <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3 (default)</option>
181 <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3 (default)</option>
182 </optgroup>
182 </optgroup>
183 <optgroup label="Branches">
183 <optgroup label="Branches">
184 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">default</option>
184 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">default</option>
185 <option value="4f7e2131323e0749a740c0a56ab68ae9269c562a">stable</option>
185 <option value="4f7e2131323e0749a740c0a56ab68ae9269c562a">stable</option>
186 </optgroup>
186 </optgroup>
187 <optgroup label="Tags">
187 <optgroup label="Tags">
188 <option value="2c96c02def9a7c997f33047761a53943e6254396">v0.2.0</option>
188 <option value="2c96c02def9a7c997f33047761a53943e6254396">v0.2.0</option>
189 <option value="8680b1d1cee3aa3c1ab3734b76ee164bbedbc5c9">v0.1.9</option>
189 <option value="8680b1d1cee3aa3c1ab3734b76ee164bbedbc5c9">v0.1.9</option>
190 <option value="ecb25ba9c96faf1e65a0bc3fd914918420a2f116">v0.1.8</option>
190 <option value="ecb25ba9c96faf1e65a0bc3fd914918420a2f116">v0.1.8</option>
191 <option value="f67633a2894edaf28513706d558205fa93df9209">v0.1.7</option>
191 <option value="f67633a2894edaf28513706d558205fa93df9209">v0.1.7</option>
192 <option value="02b38c0eb6f982174750c0e309ff9faddc0c7e12">v0.1.6</option>
192 <option value="02b38c0eb6f982174750c0e309ff9faddc0c7e12">v0.1.6</option>
193 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">v0.1.5</option>
193 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">v0.1.5</option>
194 <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">v0.1.4</option>
194 <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">v0.1.4</option>
195 <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">v0.1.3</option>
195 <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">v0.1.3</option>
196 <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">v0.1.2</option>
196 <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">v0.1.2</option>
197 <option value="fef5bfe1dc17611d5fb59a7f6f95c55c3606f933">v0.1.11</option>
197 <option value="fef5bfe1dc17611d5fb59a7f6f95c55c3606f933">v0.1.11</option>
198 <option value="92831aebf2f8dd4879e897024b89d09af214df1c">v0.1.10</option>
198 <option value="92831aebf2f8dd4879e897024b89d09af214df1c">v0.1.10</option>
199 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">v0.1.1</option>
199 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">v0.1.1</option>
200 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">tip</option>
200 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">tip</option>
201 </optgroup>
201 </optgroup>
202 """)
202 """)
203
203
204 def test_file_annotation(self):
204 def test_file_annotation(self):
205 self.log_user()
205 self.log_user()
206 response = self.app.get(url(controller='files', action='index',
206 response = self.app.get(url(controller='files', action='index',
207 repo_name=HG_REPO,
207 repo_name=HG_REPO,
208 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
208 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
209 f_path='vcs/nodes.py',
209 f_path='vcs/nodes.py',
210 annotate=True))
210 annotate=True))
211
211
212 response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">Branch: default</a></span>""")
212 response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">Branch: default</a></span>""")
213
213
214 def test_file_annotation_history(self):
214 def test_file_annotation_history(self):
215 self.log_user()
215 self.log_user()
216 response = self.app.get(url(controller='files', action='history',
216 response = self.app.get(url(controller='files', action='history',
217 repo_name=HG_REPO,
217 repo_name=HG_REPO,
218 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
218 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
219 f_path='vcs/nodes.py',
219 f_path='vcs/nodes.py',
220 annotate=True),
220 annotate=True),
221 extra_environ={'HTTP_X_PARTIAL_XHR': '1'})
221 extra_environ={'HTTP_X_PARTIAL_XHR': '1'})
222
222
223 response.mustcontain("""
223 response.mustcontain("""
224 <option value="dbec37a0d5cab8ff39af4cfc4a4cd3996e4acfc6">r648:dbec37a0d5ca (default)</option>
224 <option value="dbec37a0d5cab8ff39af4cfc4a4cd3996e4acfc6">r648:dbec37a0d5ca (default)</option>
225 <option value="1d20ed9eda9482d46ff0a6af5812550218b3ff15">r639:1d20ed9eda94 (default)</option>
225 <option value="1d20ed9eda9482d46ff0a6af5812550218b3ff15">r639:1d20ed9eda94 (default)</option>
226 <option value="0173395e822797f098799ed95c1a81b6a547a9ad">r547:0173395e8227 (default)</option>
226 <option value="0173395e822797f098799ed95c1a81b6a547a9ad">r547:0173395e8227 (default)</option>
227 <option value="afbb45ade933a8182f1d8ec5d4d1bb2de2572043">r546:afbb45ade933 (default)</option>
227 <option value="afbb45ade933a8182f1d8ec5d4d1bb2de2572043">r546:afbb45ade933 (default)</option>
228 <option value="6f093e30cac34e6b4b11275a9f22f80c5d7ad1f7">r502:6f093e30cac3 (default)</option>
228 <option value="6f093e30cac34e6b4b11275a9f22f80c5d7ad1f7">r502:6f093e30cac3 (default)</option>
229 <option value="c7e2212dd2ae975d1d06534a3d7e317165c06960">r476:c7e2212dd2ae (default)</option>
229 <option value="c7e2212dd2ae975d1d06534a3d7e317165c06960">r476:c7e2212dd2ae (default)</option>
230 <option value="45477506df79f701bf69419aac3e1f0fed3c5bcf">r472:45477506df79 (default)</option>
230 <option value="45477506df79f701bf69419aac3e1f0fed3c5bcf">r472:45477506df79 (default)</option>
231 <option value="5fc76cb25d11e07c60de040f78b8cd265ff10d53">r469:5fc76cb25d11 (default)</option>
231 <option value="5fc76cb25d11e07c60de040f78b8cd265ff10d53">r469:5fc76cb25d11 (default)</option>
232 <option value="b073433cf8994969ee5cd7cce84cbe587bb880b2">r468:b073433cf899 (default)</option>
232 <option value="b073433cf8994969ee5cd7cce84cbe587bb880b2">r468:b073433cf899 (default)</option>
233 <option value="7a74dbfcacd1dbcb58bb9c860b2f29fbb22c4c96">r467:7a74dbfcacd1 (default)</option>
233 <option value="7a74dbfcacd1dbcb58bb9c860b2f29fbb22c4c96">r467:7a74dbfcacd1 (default)</option>
234 <option value="71ee52cc4d629096bdbee036325975dac2af4501">r465:71ee52cc4d62 (default)</option>
234 <option value="71ee52cc4d629096bdbee036325975dac2af4501">r465:71ee52cc4d62 (default)</option>
235 <option value="a5b217d26c5f111e72bae4de672b084ee0fbf75c">r452:a5b217d26c5f (default)</option>
235 <option value="a5b217d26c5f111e72bae4de672b084ee0fbf75c">r452:a5b217d26c5f (default)</option>
236 <option value="47aedd538bf616eedcb0e7d630ea476df0e159c7">r450:47aedd538bf6 (default)</option>
236 <option value="47aedd538bf616eedcb0e7d630ea476df0e159c7">r450:47aedd538bf6 (default)</option>
237 <option value="8e4915fa32d727dcbf09746f637a5f82e539511e">r432:8e4915fa32d7 (default)</option>
237 <option value="8e4915fa32d727dcbf09746f637a5f82e539511e">r432:8e4915fa32d7 (default)</option>
238 <option value="25213a5fbb048dff8ba65d21e466a835536e5b70">r356:25213a5fbb04 (default)</option>
238 <option value="25213a5fbb048dff8ba65d21e466a835536e5b70">r356:25213a5fbb04 (default)</option>
239 <option value="23debcedddc1c23c14be33e713e7786d4a9de471">r351:23debcedddc1 (default)</option>
239 <option value="23debcedddc1c23c14be33e713e7786d4a9de471">r351:23debcedddc1 (default)</option>
240 <option value="61e25b2a90a19e7fffd75dea1e4c7e20df526bbe">r342:61e25b2a90a1 (default)</option>
240 <option value="61e25b2a90a19e7fffd75dea1e4c7e20df526bbe">r342:61e25b2a90a1 (default)</option>
241 <option value="fb95b340e0d03fa51f33c56c991c08077c99303e">r318:fb95b340e0d0 (webvcs)</option>
241 <option value="fb95b340e0d03fa51f33c56c991c08077c99303e">r318:fb95b340e0d0 (webvcs)</option>
242 <option value="bda35e0e564fbbc5cd26fe0a37fb647a254c99fe">r303:bda35e0e564f (default)</option>
242 <option value="bda35e0e564fbbc5cd26fe0a37fb647a254c99fe">r303:bda35e0e564f (default)</option>
243 <option value="97ff74896d7dbf3115a337a421d44b55154acc89">r302:97ff74896d7d (default)</option>
243 <option value="97ff74896d7dbf3115a337a421d44b55154acc89">r302:97ff74896d7d (default)</option>
244 <option value="cec3473c3fdb9599c98067182a075b49bde570f9">r293:cec3473c3fdb (default)</option>
244 <option value="cec3473c3fdb9599c98067182a075b49bde570f9">r293:cec3473c3fdb (default)</option>
245 <option value="0e86c43eef866a013a587666a877c879899599bb">r289:0e86c43eef86 (default)</option>
245 <option value="0e86c43eef866a013a587666a877c879899599bb">r289:0e86c43eef86 (default)</option>
246 <option value="91a27c312808100cf20a602f78befbbff9d89bfd">r288:91a27c312808 (default)</option>
246 <option value="91a27c312808100cf20a602f78befbbff9d89bfd">r288:91a27c312808 (default)</option>
247 <option value="400e36a1670a57d11e3edcb5b07bf82c30006d0b">r287:400e36a1670a (default)</option>
247 <option value="400e36a1670a57d11e3edcb5b07bf82c30006d0b">r287:400e36a1670a (default)</option>
248 <option value="014fb17dfc95b0995e838c565376bf9a993e230a">r261:014fb17dfc95 (default)</option>
248 <option value="014fb17dfc95b0995e838c565376bf9a993e230a">r261:014fb17dfc95 (default)</option>
249 <option value="cca7aebbc4d6125798446b11e69dc8847834a982">r260:cca7aebbc4d6 (default)</option>
249 <option value="cca7aebbc4d6125798446b11e69dc8847834a982">r260:cca7aebbc4d6 (default)</option>
250 <option value="14cdb2957c011a5feba36f50d960d9832ba0f0c1">r258:14cdb2957c01 (workdir)</option>
250 <option value="14cdb2957c011a5feba36f50d960d9832ba0f0c1">r258:14cdb2957c01 (workdir)</option>
251 <option value="34df20118ed74b5987d22a579e8a60e903da5bf8">r245:34df20118ed7 (default)</option>
251 <option value="34df20118ed74b5987d22a579e8a60e903da5bf8">r245:34df20118ed7 (default)</option>
252 <option value="0375d9042a64a1ac1641528f0f0668f9a339e86d">r233:0375d9042a64 (workdir)</option>
252 <option value="0375d9042a64a1ac1641528f0f0668f9a339e86d">r233:0375d9042a64 (workdir)</option>
253 <option value="94aa45fc1806c04d4ba640933edf682c22478453">r222:94aa45fc1806 (workdir)</option>
253 <option value="94aa45fc1806c04d4ba640933edf682c22478453">r222:94aa45fc1806 (workdir)</option>
254 <option value="7ed99bc738818879941e3ce20243f8856a7cfc84">r188:7ed99bc73881 (default)</option>
254 <option value="7ed99bc738818879941e3ce20243f8856a7cfc84">r188:7ed99bc73881 (default)</option>
255 <option value="1e85975528bcebe853732a9e5fb8dbf4461f6bb2">r184:1e85975528bc (default)</option>
255 <option value="1e85975528bcebe853732a9e5fb8dbf4461f6bb2">r184:1e85975528bc (default)</option>
256 <option value="ed30beddde7bbddb26042625be19bcd11576c1dd">r183:ed30beddde7b (default)</option>
256 <option value="ed30beddde7bbddb26042625be19bcd11576c1dd">r183:ed30beddde7b (default)</option>
257 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">r177:a6664e18181c (default)</option>
257 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">r177:a6664e18181c (default)</option>
258 <option value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option>
258 <option value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option>
259 <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35 (default)</option>
259 <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35 (default)</option>
260 <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c (default)</option>
260 <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c (default)</option>
261 <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329 (default)</option>
261 <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329 (default)</option>
262 <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf (git)</option>
262 <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf (git)</option>
263 <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81 (default)</option>
263 <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81 (default)</option>
264 <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc (default)</option>
264 <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc (default)</option>
265 <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21 (default)</option>
265 <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21 (default)</option>
266 <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2 (default)</option>
266 <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2 (default)</option>
267 <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85 (default)</option>
267 <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85 (default)</option>
268 <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2 (git)</option>
268 <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2 (git)</option>
269 <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93 (default)</option>
269 <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93 (default)</option>
270 <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b (default)</option>
270 <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b (default)</option>
271 <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455 (default)</option>
271 <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455 (default)</option>
272 <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32 (default)</option>
272 <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32 (default)</option>
273 <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0 (default)</option>
273 <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0 (default)</option>
274 <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081 (default)</option>
274 <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081 (default)</option>
275 <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad (default)</option>
275 <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad (default)</option>
276 <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7 (default)</option>
276 <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7 (default)</option>
277 <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059 (web)</option>
277 <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059 (web)</option>
278 <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb (web)</option>
278 <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb (web)</option>
279 <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1 (web)</option>
279 <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1 (web)</option>
280 <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71 (web)</option>
280 <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71 (web)</option>
281 <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771 (web)</option>
281 <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771 (web)</option>
282 <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526 (web)</option>
282 <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526 (web)</option>
283 <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4 (web)</option>
283 <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4 (web)</option>
284 <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b (web)</option>
284 <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b (web)</option>
285 <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c (web)</option>
285 <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c (web)</option>
286 <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1 (default)</option>
286 <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1 (default)</option>
287 <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5 (default)</option>
287 <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5 (default)</option>
288 <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283 (default)</option>
288 <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283 (default)</option>
289 <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6 (default)</option>
289 <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6 (default)</option>
290 <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3 (default)</option>
290 <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3 (default)</option>
291 </optgroup>
291 </optgroup>
292 <optgroup label="Branches">
292 <optgroup label="Branches">
293 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">default</option>
293 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">default</option>
294 <option value="4f7e2131323e0749a740c0a56ab68ae9269c562a">stable</option>
294 <option value="4f7e2131323e0749a740c0a56ab68ae9269c562a">stable</option>
295 </optgroup>
295 </optgroup>
296 <optgroup label="Tags">
296 <optgroup label="Tags">
297 <option value="2c96c02def9a7c997f33047761a53943e6254396">v0.2.0</option>
297 <option value="2c96c02def9a7c997f33047761a53943e6254396">v0.2.0</option>
298 <option value="8680b1d1cee3aa3c1ab3734b76ee164bbedbc5c9">v0.1.9</option>
298 <option value="8680b1d1cee3aa3c1ab3734b76ee164bbedbc5c9">v0.1.9</option>
299 <option value="ecb25ba9c96faf1e65a0bc3fd914918420a2f116">v0.1.8</option>
299 <option value="ecb25ba9c96faf1e65a0bc3fd914918420a2f116">v0.1.8</option>
300 <option value="f67633a2894edaf28513706d558205fa93df9209">v0.1.7</option>
300 <option value="f67633a2894edaf28513706d558205fa93df9209">v0.1.7</option>
301 <option value="02b38c0eb6f982174750c0e309ff9faddc0c7e12">v0.1.6</option>
301 <option value="02b38c0eb6f982174750c0e309ff9faddc0c7e12">v0.1.6</option>
302 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">v0.1.5</option>
302 <option value="a6664e18181c6fc81b751a8d01474e7e1a3fe7fc">v0.1.5</option>
303 <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">v0.1.4</option>
303 <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">v0.1.4</option>
304 <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">v0.1.3</option>
304 <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">v0.1.3</option>
305 <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">v0.1.2</option>
305 <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">v0.1.2</option>
306 <option value="fef5bfe1dc17611d5fb59a7f6f95c55c3606f933">v0.1.11</option>
306 <option value="fef5bfe1dc17611d5fb59a7f6f95c55c3606f933">v0.1.11</option>
307 <option value="92831aebf2f8dd4879e897024b89d09af214df1c">v0.1.10</option>
307 <option value="92831aebf2f8dd4879e897024b89d09af214df1c">v0.1.10</option>
308 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">v0.1.1</option>
308 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">v0.1.1</option>
309 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">tip</option>
309 <option value="96507bd11ecc815ebc6270fdf6db110928c09c1e">tip</option>
310 </optgroup>""")
310 </optgroup>""")
311
311
312 def test_file_annotation_git(self):
312 def test_file_annotation_git(self):
313 self.log_user()
313 self.log_user()
314 response = self.app.get(url(controller='files', action='index',
314 response = self.app.get(url(controller='files', action='index',
315 repo_name=GIT_REPO,
315 repo_name=GIT_REPO,
316 revision='master',
316 revision='master',
317 f_path='vcs/nodes.py',
317 f_path='vcs/nodes.py',
318 annotate=True))
318 annotate=True))
319
319
320 def test_archival(self):
320 def test_archival(self):
321 self.log_user()
321 self.log_user()
322 _set_downloads(HG_REPO, set_to=True)
322 _set_downloads(HG_REPO, set_to=True)
323 for arch_ext, info in ARCHIVE_SPECS.items():
323 for arch_ext, info in ARCHIVE_SPECS.items():
324 short = '27cd5cce30c9%s' % arch_ext
324 short = '27cd5cce30c9%s' % arch_ext
325 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
325 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
326 filename = '%s-%s' % (HG_REPO, short)
326 filename = '%s-%s' % (HG_REPO, short)
327 response = self.app.get(url(controller='files',
327 response = self.app.get(url(controller='files',
328 action='archivefile',
328 action='archivefile',
329 repo_name=HG_REPO,
329 repo_name=HG_REPO,
330 fname=fname))
330 fname=fname))
331
331
332 self.assertEqual(response.status, '200 OK')
332 self.assertEqual(response.status, '200 OK')
333 heads = [
333 heads = [
334 ('Pragma', 'no-cache'),
334 ('Pragma', 'no-cache'),
335 ('Cache-Control', 'no-cache'),
335 ('Cache-Control', 'no-cache'),
336 ('Content-Disposition', 'attachment; filename=%s' % filename),
336 ('Content-Disposition', 'attachment; filename=%s' % filename),
337 ('Content-Type', '%s; charset=utf-8' % info[0]),
337 ('Content-Type', '%s; charset=utf-8' % info[0]),
338 ]
338 ]
339 self.assertEqual(response.response._headers.items(), heads)
339 self.assertEqual(response.response._headers.items(), heads)
340
340
341 def test_archival_wrong_ext(self):
341 def test_archival_wrong_ext(self):
342 self.log_user()
342 self.log_user()
343 _set_downloads(HG_REPO, set_to=True)
343 _set_downloads(HG_REPO, set_to=True)
344 for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']:
344 for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']:
345 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
345 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
346
346
347 response = self.app.get(url(controller='files',
347 response = self.app.get(url(controller='files',
348 action='archivefile',
348 action='archivefile',
349 repo_name=HG_REPO,
349 repo_name=HG_REPO,
350 fname=fname))
350 fname=fname))
351 response.mustcontain('Unknown archive type')
351 response.mustcontain('Unknown archive type')
352
352
353 def test_archival_wrong_revision(self):
353 def test_archival_wrong_revision(self):
354 self.log_user()
354 self.log_user()
355 _set_downloads(HG_REPO, set_to=True)
355 _set_downloads(HG_REPO, set_to=True)
356 for rev in ['00x000000', 'tar', 'wrong', '@##$@$42413232', '232dffcd']:
356 for rev in ['00x000000', 'tar', 'wrong', '@##$@$42413232', '232dffcd']:
357 fname = '%s.zip' % rev
357 fname = '%s.zip' % rev
358
358
359 response = self.app.get(url(controller='files',
359 response = self.app.get(url(controller='files',
360 action='archivefile',
360 action='archivefile',
361 repo_name=HG_REPO,
361 repo_name=HG_REPO,
362 fname=fname))
362 fname=fname))
363 response.mustcontain('Unknown revision')
363 response.mustcontain('Unknown revision')
364
364
365 #==========================================================================
365 #==========================================================================
366 # RAW FILE
366 # RAW FILE
367 #==========================================================================
367 #==========================================================================
368 def test_raw_file_ok(self):
368 def test_raw_file_ok(self):
369 self.log_user()
369 self.log_user()
370 response = self.app.get(url(controller='files', action='rawfile',
370 response = self.app.get(url(controller='files', action='rawfile',
371 repo_name=HG_REPO,
371 repo_name=HG_REPO,
372 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
372 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
373 f_path='vcs/nodes.py'))
373 f_path='vcs/nodes.py'))
374
374
375 self.assertEqual(response.content_disposition, "attachment; filename=nodes.py")
375 self.assertEqual(response.content_disposition, "attachment; filename=nodes.py")
376 self.assertEqual(response.content_type, "text/x-python")
376 self.assertEqual(response.content_type, "text/x-python")
377
377
378 def test_raw_file_wrong_cs(self):
378 def test_raw_file_wrong_cs(self):
379 self.log_user()
379 self.log_user()
380 rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc'
380 rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc'
381 f_path = 'vcs/nodes.py'
381 f_path = 'vcs/nodes.py'
382
382
383 response = self.app.get(url(controller='files', action='rawfile',
383 response = self.app.get(url(controller='files', action='rawfile',
384 repo_name=HG_REPO,
384 repo_name=HG_REPO,
385 revision=rev,
385 revision=rev,
386 f_path=f_path), status=404)
386 f_path=f_path), status=404)
387
387
388 msg = """Revision %s does not exist for this repository""" % (rev)
388 msg = """Revision %s does not exist for this repository""" % (rev)
389 response.mustcontain(msg)
389 response.mustcontain(msg)
390
390
391 def test_raw_file_wrong_f_path(self):
391 def test_raw_file_wrong_f_path(self):
392 self.log_user()
392 self.log_user()
393 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
393 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
394 f_path = 'vcs/ERRORnodes.py'
394 f_path = 'vcs/ERRORnodes.py'
395 response = self.app.get(url(controller='files', action='rawfile',
395 response = self.app.get(url(controller='files', action='rawfile',
396 repo_name=HG_REPO,
396 repo_name=HG_REPO,
397 revision=rev,
397 revision=rev,
398 f_path=f_path), status=404)
398 f_path=f_path), status=404)
399
399
400 msg = "There is no file nor directory at the given path: &#39;%s&#39; at revision %s" % (f_path, rev[:12])
400 msg = "There is no file nor directory at the given path: &#39;%s&#39; at revision %s" % (f_path, rev[:12])
401 response.mustcontain(msg)
401 response.mustcontain(msg)
402
402
403 #==========================================================================
403 #==========================================================================
404 # RAW RESPONSE - PLAIN
404 # RAW RESPONSE - PLAIN
405 #==========================================================================
405 #==========================================================================
406 def test_raw_ok(self):
406 def test_raw_ok(self):
407 self.log_user()
407 self.log_user()
408 response = self.app.get(url(controller='files', action='raw',
408 response = self.app.get(url(controller='files', action='raw',
409 repo_name=HG_REPO,
409 repo_name=HG_REPO,
410 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
410 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
411 f_path='vcs/nodes.py'))
411 f_path='vcs/nodes.py'))
412
412
413 self.assertEqual(response.content_type, "text/plain")
413 self.assertEqual(response.content_type, "text/plain")
414
414
415 def test_raw_wrong_cs(self):
415 def test_raw_wrong_cs(self):
416 self.log_user()
416 self.log_user()
417 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc'
417 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc'
418 f_path = 'vcs/nodes.py'
418 f_path = 'vcs/nodes.py'
419
419
420 response = self.app.get(url(controller='files', action='raw',
420 response = self.app.get(url(controller='files', action='raw',
421 repo_name=HG_REPO,
421 repo_name=HG_REPO,
422 revision=rev,
422 revision=rev,
423 f_path=f_path), status=404)
423 f_path=f_path), status=404)
424
424
425 msg = """Revision %s does not exist for this repository""" % (rev)
425 msg = """Revision %s does not exist for this repository""" % (rev)
426 response.mustcontain(msg)
426 response.mustcontain(msg)
427
427
428 def test_raw_wrong_f_path(self):
428 def test_raw_wrong_f_path(self):
429 self.log_user()
429 self.log_user()
430 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
430 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
431 f_path = 'vcs/ERRORnodes.py'
431 f_path = 'vcs/ERRORnodes.py'
432 response = self.app.get(url(controller='files', action='raw',
432 response = self.app.get(url(controller='files', action='raw',
433 repo_name=HG_REPO,
433 repo_name=HG_REPO,
434 revision=rev,
434 revision=rev,
435 f_path=f_path), status=404)
435 f_path=f_path), status=404)
436 msg = "There is no file nor directory at the given path: &#39;%s&#39; at revision %s" % (f_path, rev[:12])
436 msg = "There is no file nor directory at the given path: &#39;%s&#39; at revision %s" % (f_path, rev[:12])
437 response.mustcontain(msg)
437 response.mustcontain(msg)
438
438
439 def test_ajaxed_files_list(self):
439 def test_ajaxed_files_list(self):
440 self.log_user()
440 self.log_user()
441 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
441 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
442 response = self.app.get(
442 response = self.app.get(
443 url('files_nodelist_home', repo_name=HG_REPO, f_path='/',
443 url('files_nodelist_home', repo_name=HG_REPO, f_path='/',
444 revision=rev),
444 revision=rev),
445 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},
445 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},
446 )
446 )
447 response.mustcontain("vcs/web/simplevcs/views/repository.py")
447 response.mustcontain("vcs/web/simplevcs/views/repository.py")
448
448
449 #HG - ADD FILE
449 #HG - ADD FILE
450 def test_add_file_view_hg(self):
450 def test_add_file_view_hg(self):
451 self.log_user()
451 self.log_user()
452 response = self.app.get(url('files_add_home',
452 response = self.app.get(url('files_add_home',
453 repo_name=HG_REPO,
453 repo_name=HG_REPO,
454 revision='tip', f_path='/'))
454 revision='tip', f_path='/'))
455
455
456 def test_add_file_into_hg_missing_content(self):
456 def test_add_file_into_hg_missing_content(self):
457 self.log_user()
457 self.log_user()
458 response = self.app.post(url('files_add_home',
458 response = self.app.post(url('files_add_home',
459 repo_name=HG_REPO,
459 repo_name=HG_REPO,
460 revision='tip', f_path='/'),
460 revision='tip', f_path='/'),
461 params={
461 params={
462 ''
462 'content': ''
463 },
463 },
464 status=302)
464 status=302)
465
465
466 self.checkSessionFlash(response, 'No content')
466 self.checkSessionFlash(response, 'No content')
467
467
468 def test_add_file_into_hg_missing_filename(self):
468 def test_add_file_into_hg_missing_filename(self):
469 self.log_user()
469 self.log_user()
470 response = self.app.post(url('files_add_home',
470 response = self.app.post(url('files_add_home',
471 repo_name=HG_REPO,
471 repo_name=HG_REPO,
472 revision='tip', f_path='/'),
472 revision='tip', f_path='/'),
473 params={
473 params={
474 'content': "foo"
474 'content': "foo"
475 },
475 },
476 status=302)
476 status=302)
477
477
478 self.checkSessionFlash(response, 'No filename')
478 self.checkSessionFlash(response, 'No filename')
479
479
480 @parameterized.expand([
480 @parameterized.expand([
481 ('/abs', 'foo'),
481 ('/abs', 'foo'),
482 ('../rel', 'foo'),
482 ('../rel', 'foo'),
483 ('file/../foo', 'foo'),
483 ('file/../foo', 'foo'),
484 ])
484 ])
485 def test_add_file_into_hg_bad_filenames(self, location, filename):
485 def test_add_file_into_hg_bad_filenames(self, location, filename):
486 self.log_user()
486 self.log_user()
487 response = self.app.post(url('files_add_home',
487 response = self.app.post(url('files_add_home',
488 repo_name=HG_REPO,
488 repo_name=HG_REPO,
489 revision='tip', f_path='/'),
489 revision='tip', f_path='/'),
490 params={
490 params={
491 'content': "foo",
491 'content': "foo",
492 'filename': filename,
492 'filename': filename,
493 'location': location
493 'location': location
494 },
494 },
495 status=302)
495 status=302)
496
496
497 self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path')
497 self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path')
498
498
499 @parameterized.expand([
499 @parameterized.expand([
500 (1, '', 'foo.txt'),
500 (1, '', 'foo.txt'),
501 (2, 'dir', 'foo.rst'),
501 (2, 'dir', 'foo.rst'),
502 (3, 'rel/dir', 'foo.bar'),
502 (3, 'rel/dir', 'foo.bar'),
503 ])
503 ])
504 def test_add_file_into_hg(self, cnt, location, filename):
504 def test_add_file_into_hg(self, cnt, location, filename):
505 self.log_user()
505 self.log_user()
506 repo = fixture.create_repo('commit-test-%s' % cnt, repo_type='hg')
506 repo = fixture.create_repo('commit-test-%s' % cnt, repo_type='hg')
507 response = self.app.post(url('files_add_home',
507 response = self.app.post(url('files_add_home',
508 repo_name=repo.repo_name,
508 repo_name=repo.repo_name,
509 revision='tip', f_path='/'),
509 revision='tip', f_path='/'),
510 params={
510 params={
511 'content': "foo",
511 'content': "foo",
512 'filename': filename,
512 'filename': filename,
513 'location': location
513 'location': location
514 },
514 },
515 status=302)
515 status=302)
516 try:
516 try:
517 self.checkSessionFlash(response, 'Successfully committed to %s'
517 self.checkSessionFlash(response, 'Successfully committed to %s'
518 % os.path.join(location, filename))
518 % os.path.join(location, filename))
519 finally:
519 finally:
520 fixture.destroy_repo(repo.repo_name)
520 fixture.destroy_repo(repo.repo_name)
521
521
522 ##GIT - ADD FILE
522 ##GIT - ADD FILE
523 def test_add_file_view_git(self):
523 def test_add_file_view_git(self):
524 self.log_user()
524 self.log_user()
525 response = self.app.get(url('files_add_home',
525 response = self.app.get(url('files_add_home',
526 repo_name=GIT_REPO,
526 repo_name=GIT_REPO,
527 revision='tip', f_path='/'))
527 revision='tip', f_path='/'))
528
528
529 def test_add_file_into_git_missing_content(self):
529 def test_add_file_into_git_missing_content(self):
530 self.log_user()
530 self.log_user()
531 response = self.app.post(url('files_add_home',
531 response = self.app.post(url('files_add_home',
532 repo_name=GIT_REPO,
532 repo_name=GIT_REPO,
533 revision='tip', f_path='/'),
533 revision='tip', f_path='/'),
534 params={
534 params={
535 ''
535 ''
536 },
536 },
537 status=302)
537 status=302)
538
538
539 self.checkSessionFlash(response, 'No content')
539 self.checkSessionFlash(response, 'No content')
540
540
541 def test_add_file_into_git_missing_filename(self):
541 def test_add_file_into_git_missing_filename(self):
542 self.log_user()
542 self.log_user()
543 response = self.app.post(url('files_add_home',
543 response = self.app.post(url('files_add_home',
544 repo_name=GIT_REPO,
544 repo_name=GIT_REPO,
545 revision='tip', f_path='/'),
545 revision='tip', f_path='/'),
546 params={
546 params={
547 'content': "foo"
547 'content': "foo"
548 },
548 },
549 status=302)
549 status=302)
550
550
551 self.checkSessionFlash(response, 'No filename')
551 self.checkSessionFlash(response, 'No filename')
552
552
553 @parameterized.expand([
553 @parameterized.expand([
554 ('/abs', 'foo'),
554 ('/abs', 'foo'),
555 ('../rel', 'foo'),
555 ('../rel', 'foo'),
556 ('file/../foo', 'foo'),
556 ('file/../foo', 'foo'),
557 ])
557 ])
558 def test_add_file_into_git_bad_filenames(self, location, filename):
558 def test_add_file_into_git_bad_filenames(self, location, filename):
559 self.log_user()
559 self.log_user()
560 response = self.app.post(url('files_add_home',
560 response = self.app.post(url('files_add_home',
561 repo_name=GIT_REPO,
561 repo_name=GIT_REPO,
562 revision='tip', f_path='/'),
562 revision='tip', f_path='/'),
563 params={
563 params={
564 'content': "foo",
564 'content': "foo",
565 'filename': filename,
565 'filename': filename,
566 'location': location
566 'location': location
567 },
567 },
568 status=302)
568 status=302)
569
569
570 self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path')
570 self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path')
571
571
572 @parameterized.expand([
572 @parameterized.expand([
573 (1, '', 'foo.txt'),
573 (1, '', 'foo.txt'),
574 (2, 'dir', 'foo.rst'),
574 (2, 'dir', 'foo.rst'),
575 (3, 'rel/dir', 'foo.bar'),
575 (3, 'rel/dir', 'foo.bar'),
576 ])
576 ])
577 def test_add_file_into_git(self, cnt, location, filename):
577 def test_add_file_into_git(self, cnt, location, filename):
578 self.log_user()
578 self.log_user()
579 repo = fixture.create_repo('commit-test-%s' % cnt, repo_type='git')
579 repo = fixture.create_repo('commit-test-%s' % cnt, repo_type='git')
580 response = self.app.post(url('files_add_home',
580 response = self.app.post(url('files_add_home',
581 repo_name=repo.repo_name,
581 repo_name=repo.repo_name,
582 revision='tip', f_path='/'),
582 revision='tip', f_path='/'),
583 params={
583 params={
584 'content': "foo",
584 'content': "foo",
585 'filename': filename,
585 'filename': filename,
586 'location': location
586 'location': location
587 },
587 },
588 status=302)
588 status=302)
589 try:
589 try:
590 self.checkSessionFlash(response, 'Successfully committed to %s'
590 self.checkSessionFlash(response, 'Successfully committed to %s'
591 % os.path.join(location, filename))
591 % os.path.join(location, filename))
592 finally:
592 finally:
593 fixture.destroy_repo(repo.repo_name)
593 fixture.destroy_repo(repo.repo_name)
594
594
595 #HG - EDIT
595 #HG - EDIT
596 def test_edit_file_view_hg(self):
596 def test_edit_file_view_hg(self):
597 self.log_user()
597 self.log_user()
598 response = self.app.get(url('files_edit_home',
598 response = self.app.get(url('files_edit_home',
599 repo_name=HG_REPO,
599 repo_name=HG_REPO,
600 revision='tip', f_path='vcs/nodes.py'))
600 revision='tip', f_path='vcs/nodes.py'))
601
601
602 def test_edit_file_view_not_on_branch_hg(self):
602 def test_edit_file_view_not_on_branch_hg(self):
603 self.log_user()
603 self.log_user()
604 repo = fixture.create_repo('test-edit-repo', repo_type='hg')
604 repo = fixture.create_repo('test-edit-repo', repo_type='hg')
605
605
606 ## add file
606 ## add file
607 location = 'vcs'
607 location = 'vcs'
608 filename = 'nodes.py'
608 filename = 'nodes.py'
609 response = self.app.post(url('files_add_home',
609 response = self.app.post(url('files_add_home',
610 repo_name=repo.repo_name,
610 repo_name=repo.repo_name,
611 revision='tip', f_path='/'),
611 revision='tip', f_path='/'),
612 params={
612 params={
613 'content': "def py():\n print 'hello'\n",
613 'content': "def py():\n print 'hello'\n",
614 'filename': filename,
614 'filename': filename,
615 'location': location
615 'location': location
616 },
616 },
617 status=302)
617 status=302)
618 response.follow()
618 response.follow()
619 try:
619 try:
620 self.checkSessionFlash(response, 'Successfully committed to %s'
620 self.checkSessionFlash(response, 'Successfully committed to %s'
621 % os.path.join(location, filename))
621 % os.path.join(location, filename))
622 response = self.app.get(url('files_edit_home',
622 response = self.app.get(url('files_edit_home',
623 repo_name=repo.repo_name,
623 repo_name=repo.repo_name,
624 revision='tip', f_path='vcs/nodes.py'),
624 revision='tip', f_path='vcs/nodes.py'),
625 status=302)
625 status=302)
626 self.checkSessionFlash(response,
626 self.checkSessionFlash(response,
627 'You can only edit files with revision being a valid branch')
627 'You can only edit files with revision being a valid branch')
628 finally:
628 finally:
629 fixture.destroy_repo(repo.repo_name)
629 fixture.destroy_repo(repo.repo_name)
630
630
631 def test_edit_file_view_commit_changes_hg(self):
631 def test_edit_file_view_commit_changes_hg(self):
632 self.log_user()
632 self.log_user()
633 repo = fixture.create_repo('test-edit-repo', repo_type='hg')
633 repo = fixture.create_repo('test-edit-repo', repo_type='hg')
634
634
635 ## add file
635 ## add file
636 location = 'vcs'
636 location = 'vcs'
637 filename = 'nodes.py'
637 filename = 'nodes.py'
638 response = self.app.post(url('files_add_home',
638 response = self.app.post(url('files_add_home',
639 repo_name=repo.repo_name,
639 repo_name=repo.repo_name,
640 revision='tip',
640 revision='tip',
641 f_path='/'),
641 f_path='/'),
642 params={
642 params={
643 'content': "def py():\n print 'hello'\n",
643 'content': "def py():\n print 'hello'\n",
644 'filename': filename,
644 'filename': filename,
645 'location': location
645 'location': location
646 },
646 },
647 status=302)
647 status=302)
648 response.follow()
648 response.follow()
649 try:
649 try:
650 self.checkSessionFlash(response, 'Successfully committed to %s'
650 self.checkSessionFlash(response, 'Successfully committed to %s'
651 % os.path.join(location, filename))
651 % os.path.join(location, filename))
652 response = self.app.post(url('files_edit_home',
652 response = self.app.post(url('files_edit_home',
653 repo_name=repo.repo_name,
653 repo_name=repo.repo_name,
654 revision=repo.scm_instance.DEFAULT_BRANCH_NAME,
654 revision=repo.scm_instance.DEFAULT_BRANCH_NAME,
655 f_path='vcs/nodes.py'),
655 f_path='vcs/nodes.py'),
656 params={
656 params={
657 'content': "def py():\n print 'hello world'\n",
657 'content': "def py():\n print 'hello world'\n",
658 'message': 'i commited',
658 'message': 'i commited',
659 },
659 },
660 status=302)
660 status=302)
661 self.checkSessionFlash(response,
661 self.checkSessionFlash(response,
662 'Successfully committed to vcs/nodes.py')
662 'Successfully committed to vcs/nodes.py')
663 finally:
663 finally:
664 fixture.destroy_repo(repo.repo_name)
664 fixture.destroy_repo(repo.repo_name)
665
665
666 #GIT - EDIT
666 #GIT - EDIT
667 def test_edit_file_view_git(self):
667 def test_edit_file_view_git(self):
668 self.log_user()
668 self.log_user()
669 response = self.app.get(url('files_edit_home',
669 response = self.app.get(url('files_edit_home',
670 repo_name=GIT_REPO,
670 repo_name=GIT_REPO,
671 revision='tip', f_path='vcs/nodes.py'))
671 revision='tip', f_path='vcs/nodes.py'))
672
672
673 def test_edit_file_view_not_on_branch_git(self):
673 def test_edit_file_view_not_on_branch_git(self):
674 self.log_user()
674 self.log_user()
675 repo = fixture.create_repo('test-edit-repo', repo_type='git')
675 repo = fixture.create_repo('test-edit-repo', repo_type='git')
676
676
677 ## add file
677 ## add file
678 location = 'vcs'
678 location = 'vcs'
679 filename = 'nodes.py'
679 filename = 'nodes.py'
680 response = self.app.post(url('files_add_home',
680 response = self.app.post(url('files_add_home',
681 repo_name=repo.repo_name,
681 repo_name=repo.repo_name,
682 revision='tip', f_path='/'),
682 revision='tip', f_path='/'),
683 params={
683 params={
684 'content': "def py():\n print 'hello'\n",
684 'content': "def py():\n print 'hello'\n",
685 'filename': filename,
685 'filename': filename,
686 'location': location
686 'location': location
687 },
687 },
688 status=302)
688 status=302)
689 response.follow()
689 response.follow()
690 try:
690 try:
691 self.checkSessionFlash(response, 'Successfully committed to %s'
691 self.checkSessionFlash(response, 'Successfully committed to %s'
692 % os.path.join(location, filename))
692 % os.path.join(location, filename))
693 response = self.app.get(url('files_edit_home',
693 response = self.app.get(url('files_edit_home',
694 repo_name=repo.repo_name,
694 repo_name=repo.repo_name,
695 revision='tip', f_path='vcs/nodes.py'),
695 revision='tip', f_path='vcs/nodes.py'),
696 status=302)
696 status=302)
697 self.checkSessionFlash(response,
697 self.checkSessionFlash(response,
698 'You can only edit files with revision being a valid branch')
698 'You can only edit files with revision being a valid branch')
699 finally:
699 finally:
700 fixture.destroy_repo(repo.repo_name)
700 fixture.destroy_repo(repo.repo_name)
701
701
702 def test_edit_file_view_commit_changes_git(self):
702 def test_edit_file_view_commit_changes_git(self):
703 self.log_user()
703 self.log_user()
704 repo = fixture.create_repo('test-edit-repo', repo_type='git')
704 repo = fixture.create_repo('test-edit-repo', repo_type='git')
705
705
706 ## add file
706 ## add file
707 location = 'vcs'
707 location = 'vcs'
708 filename = 'nodes.py'
708 filename = 'nodes.py'
709 response = self.app.post(url('files_add_home',
709 response = self.app.post(url('files_add_home',
710 repo_name=repo.repo_name,
710 repo_name=repo.repo_name,
711 revision='tip',
711 revision='tip',
712 f_path='/'),
712 f_path='/'),
713 params={
713 params={
714 'content': "def py():\n print 'hello'\n",
714 'content': "def py():\n print 'hello'\n",
715 'filename': filename,
715 'filename': filename,
716 'location': location
716 'location': location
717 },
717 },
718 status=302)
718 status=302)
719 response.follow()
719 response.follow()
720 try:
720 try:
721 self.checkSessionFlash(response, 'Successfully committed to %s'
721 self.checkSessionFlash(response, 'Successfully committed to %s'
722 % os.path.join(location, filename))
722 % os.path.join(location, filename))
723 response = self.app.post(url('files_edit_home',
723 response = self.app.post(url('files_edit_home',
724 repo_name=repo.repo_name,
724 repo_name=repo.repo_name,
725 revision=repo.scm_instance.DEFAULT_BRANCH_NAME,
725 revision=repo.scm_instance.DEFAULT_BRANCH_NAME,
726 f_path='vcs/nodes.py'),
726 f_path='vcs/nodes.py'),
727 params={
727 params={
728 'content': "def py():\n print 'hello world'\n",
728 'content': "def py():\n print 'hello world'\n",
729 'message': 'i commited',
729 'message': 'i commited',
730 },
730 },
731 status=302)
731 status=302)
732 self.checkSessionFlash(response,
732 self.checkSessionFlash(response,
733 'Successfully committed to vcs/nodes.py')
733 'Successfully committed to vcs/nodes.py')
734 finally:
734 finally:
735 fixture.destroy_repo(repo.repo_name)
735 fixture.destroy_repo(repo.repo_name)
General Comments 0
You need to be logged in to leave comments. Login now