Mercurial > kallithea
annotate kallithea/tests/functional/test_files.py @ 4275:cdf89e722ef6
templates: don't use explicit uppercase style - shouting is rude
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 18 Jul 2014 18:44:54 +0200 |
parents | d1addaf7a91e |
children | 43cafe348c9a |
rev | line source |
---|---|
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
1 # -*- coding: utf-8 -*- |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
2 import os |
4186
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.tests import * |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
4 from kallithea.model.db import Repository |
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.meta import Session |
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.tests.fixture import Fixture |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
7 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
8 fixture = Fixture() |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
10 ARCHIVE_SPECS = { |
951
48896664e987
fixes for issue #104, code rewrites for vcs 0.2
Marcin Kuzminski <marcin@python-works.com>
parents:
873
diff
changeset
|
11 '.tar.bz2': ('application/x-bzip2', 'tbz2', ''), |
48896664e987
fixes for issue #104, code rewrites for vcs 0.2
Marcin Kuzminski <marcin@python-works.com>
parents:
873
diff
changeset
|
12 '.tar.gz': ('application/x-gzip', 'tgz', ''), |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
13 '.zip': ('application/zip', 'zip', ''), |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
14 } |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
15 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
16 HG_NODE_HISTORY = fixture.load_resource('hg_node_history_response.json') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
17 GIT_NODE_HISTORY = fixture.load_resource('git_node_history_response.json') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
18 |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
19 |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
20 def _set_downloads(repo_name, set_to): |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
21 repo = Repository.get_by_repo_name(repo_name) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
22 repo.enable_downloads = set_to |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
23 Session().add(repo) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
24 Session().commit() |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
25 |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
26 |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 class TestFilesController(TestController): |
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 |
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 def test_index(self): |
473
6b934c9607e7
Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
30 self.log_user() |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
31 response = self.app.get(url(controller='files', action='index', |
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
|
32 repo_name=HG_REPO, |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
33 revision='tip', |
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
34 f_path='/')) |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 # Test response... |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
36 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/docs">docs</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
37 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/vcs">vcs</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
38 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.gitignore">.gitignore</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
39 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgignore">.hgignore</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
40 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgtags">.hgtags</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
41 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.travis.yml">.travis.yml</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
42 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/MANIFEST.in">MANIFEST.in</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
43 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/README.rst">README.rst</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
44 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>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
45 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.cfg">setup.cfg</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
46 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.py">setup.py</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
47 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/test_and_report.sh">test_and_report.sh</a>') |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
48 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/tox.ini">tox.ini</a>') |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
49 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
50 def test_index_revision(self): |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
51 self.log_user() |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
52 |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
53 response = self.app.get( |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
54 url(controller='files', action='index', |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
55 repo_name=HG_REPO, |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
56 revision='7ba66bec8d6dbba14a2155be32408c435c5f4492', |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
57 f_path='/') |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
58 ) |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
59 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
60 #Test response... |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
61 |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
62 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>') |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
63 response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>') |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
64 response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>') |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
65 response.mustcontain('1.1 KiB') |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
66 response.mustcontain('text/x-python') |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
67 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
68 def test_index_different_branch(self): |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
69 self.log_user() |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
70 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
71 response = self.app.get(url(controller='files', action='index', |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
72 repo_name=HG_REPO, |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
73 revision='97e8b885c04894463c51898e14387d80c30ed1ee', |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
74 f_path='/')) |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
75 |
4275
cdf89e722ef6
templates: don't use explicit uppercase style - shouting is rude
Mads Kiilerich <madski@unity3d.com>
parents:
4187
diff
changeset
|
76 response.mustcontain("""<a href="#">Branch: git</a>""") |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
77 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
78 def test_index_paging(self): |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
79 self.log_user() |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
80 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
81 for r in [(73, 'a066b25d5df7016b45a41b7e2a78c33b57adc235'), |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
82 (92, 'cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e'), |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
83 (109, '75feb4c33e81186c87eac740cee2447330288412'), |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
84 (1, '3d8f361e72ab303da48d799ff1ac40d5ac37c67e'), |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
85 (0, 'b986218ba1c9b0d6a259fac9b050b1724ed8e545')]: |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
86 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
87 response = self.app.get(url(controller='files', action='index', |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
88 repo_name=HG_REPO, |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
89 revision=r[1], |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
90 f_path='/')) |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
91 |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
92 response.mustcontain("""@ r%s:%s""" % (r[0], r[1][:12])) |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
93 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
94 def test_file_source(self): |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
95 self.log_user() |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
96 response = self.app.get(url(controller='files', action='index', |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
97 repo_name=HG_REPO, |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3654
diff
changeset
|
98 revision='8911406ad776fdd3d0b9932a2e89677e57405a48', |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
99 f_path='vcs/nodes.py')) |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
100 |
3009
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
101 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. |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
102 In addition some other __str__ are unicode as well |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
103 Added test for unicode |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
104 Improved test to clone into uniq repository. |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
105 removed extra unicode conversion in diff.</div> |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
106 """) |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
107 |
4275
cdf89e722ef6
templates: don't use explicit uppercase style - shouting is rude
Mads Kiilerich <madski@unity3d.com>
parents:
4187
diff
changeset
|
108 response.mustcontain("""<a href="#">Branch: default</a>""") |
3009
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
109 |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
110 def test_file_source_history(self): |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
111 self.log_user() |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
112 response = self.app.get(url(controller='files', action='history', |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
113 repo_name=HG_REPO, |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
114 revision='tip', |
3009
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
115 f_path='vcs/nodes.py'), |
f0e19116f154
fixed file history tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2947
diff
changeset
|
116 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
117 self.assertEqual(response.body, HG_NODE_HISTORY) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
118 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
119 def test_file_source_history_git(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
120 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
121 response = self.app.get(url(controller='files', action='history', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
122 repo_name=GIT_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
123 revision='master', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
124 f_path='vcs/nodes.py'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
125 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
126 self.assertEqual(response.body, GIT_NODE_HISTORY) |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
127 |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
128 def test_file_annotation(self): |
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
129 self.log_user() |
2180
c2d3cb1fdbde
fixed annotate tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2085
diff
changeset
|
130 response = self.app.get(url(controller='files', action='index', |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
131 repo_name=HG_REPO, |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
132 revision='tip', |
2180
c2d3cb1fdbde
fixed annotate tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2085
diff
changeset
|
133 f_path='vcs/nodes.py', |
c2d3cb1fdbde
fixed annotate tests
Marcin Kuzminski <marcin@python-works.com>
parents:
2085
diff
changeset
|
134 annotate=True)) |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
135 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
136 response.mustcontain("""r356:25213a5fbb04""") |
729
942803947f67
added some tests for files
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
137 |
2451
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
138 def test_file_annotation_git(self): |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
139 self.log_user() |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
140 response = self.app.get(url(controller='files', action='index', |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
141 repo_name=GIT_REPO, |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
142 revision='master', |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
143 f_path='vcs/nodes.py', |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
144 annotate=True)) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
145 response.mustcontain("""r345:c994f0de03b2""") |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
146 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
147 def test_file_annotation_history(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
148 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
149 response = self.app.get(url(controller='files', action='history', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
150 repo_name=HG_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
151 revision='tip', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
152 f_path='vcs/nodes.py', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
153 annotate=True), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
154 extra_environ={'HTTP_X_PARTIAL_XHR': '1'}) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
155 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
156 self.assertEqual(response.body, HG_NODE_HISTORY) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
157 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
158 def test_file_annotation_history_git(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
159 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
160 response = self.app.get(url(controller='files', action='history', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
161 repo_name=GIT_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
162 revision='master', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
163 f_path='vcs/nodes.py', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
164 annotate=True), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
165 extra_environ={'HTTP_X_PARTIAL_XHR': '1'}) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
166 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
167 self.assertEqual(response.body, GIT_NODE_HISTORY) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
168 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
169 def test_file_authors(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
170 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
171 response = self.app.get(url(controller='files', action='authors', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
172 repo_name=HG_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
173 revision='tip', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
174 f_path='vcs/nodes.py', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
175 annotate=True)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
176 response.mustcontain('Marcin Kuzminski') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
177 response.mustcontain('Lukasz Balcerzak') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
178 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
179 def test_file_authors_git(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
180 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
181 response = self.app.get(url(controller='files', action='authors', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
182 repo_name=GIT_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
183 revision='master', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
184 f_path='vcs/nodes.py', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
185 annotate=True)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
186 response.mustcontain('Marcin Kuzminski') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
187 response.mustcontain('Lukasz Balcerzak') |
2451
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
188 |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
189 def test_archival(self): |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
190 self.log_user() |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
191 _set_downloads(HG_REPO, set_to=True) |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
192 for arch_ext, info in ARCHIVE_SPECS.items(): |
2277
bb0309b4e1ee
fixed tests, and archival method
Marcin Kuzminski <marcin@python-works.com>
parents:
2255
diff
changeset
|
193 short = '27cd5cce30c9%s' % arch_ext |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
194 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext |
2277
bb0309b4e1ee
fixed tests, and archival method
Marcin Kuzminski <marcin@python-works.com>
parents:
2255
diff
changeset
|
195 filename = '%s-%s' % (HG_REPO, short) |
2289
5893414dea91
renamed setup module into a setup_rhodecode.
Marcin Kuzminski <marcin@python-works.com>
parents:
2277
diff
changeset
|
196 response = self.app.get(url(controller='files', |
2277
bb0309b4e1ee
fixed tests, and archival method
Marcin Kuzminski <marcin@python-works.com>
parents:
2255
diff
changeset
|
197 action='archivefile', |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
198 repo_name=HG_REPO, |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
199 fname=fname)) |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
200 |
2255
95800dad44d0
fixes for tests on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2180
diff
changeset
|
201 self.assertEqual(response.status, '200 OK') |
2294
3c1d991755df
Use paste fileapp to properly send the archive size
Marcin Kuzminski <marcin@python-works.com>
parents:
2289
diff
changeset
|
202 heads = [ |
2367
86aa4f1f130b
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2318
diff
changeset
|
203 ('Pragma', 'no-cache'), |
86aa4f1f130b
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2318
diff
changeset
|
204 ('Cache-Control', 'no-cache'), |
2318
058e2743e7b7
fixes issue #455 Creating an archive generates an exception on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2294
diff
changeset
|
205 ('Content-Disposition', 'attachment; filename=%s' % filename), |
058e2743e7b7
fixes issue #455 Creating an archive generates an exception on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2294
diff
changeset
|
206 ('Content-Type', '%s; charset=utf-8' % info[0]), |
2294
3c1d991755df
Use paste fileapp to properly send the archive size
Marcin Kuzminski <marcin@python-works.com>
parents:
2289
diff
changeset
|
207 ] |
3c1d991755df
Use paste fileapp to properly send the archive size
Marcin Kuzminski <marcin@python-works.com>
parents:
2289
diff
changeset
|
208 self.assertEqual(response.response._headers.items(), heads) |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
209 |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
210 def test_archival_wrong_ext(self): |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
211 self.log_user() |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
212 _set_downloads(HG_REPO, set_to=True) |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
213 for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']: |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
214 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
215 |
2367
86aa4f1f130b
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2318
diff
changeset
|
216 response = self.app.get(url(controller='files', |
2318
058e2743e7b7
fixes issue #455 Creating an archive generates an exception on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2294
diff
changeset
|
217 action='archivefile', |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
218 repo_name=HG_REPO, |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
219 fname=fname)) |
2255
95800dad44d0
fixes for tests on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2180
diff
changeset
|
220 response.mustcontain('Unknown archive type') |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
221 |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
222 def test_archival_wrong_revision(self): |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
223 self.log_user() |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3009
diff
changeset
|
224 _set_downloads(HG_REPO, set_to=True) |
2318
058e2743e7b7
fixes issue #455 Creating an archive generates an exception on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2294
diff
changeset
|
225 for rev in ['00x000000', 'tar', 'wrong', '@##$@$42413232', '232dffcd']: |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
226 fname = '%s.zip' % rev |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
227 |
2318
058e2743e7b7
fixes issue #455 Creating an archive generates an exception on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2294
diff
changeset
|
228 response = self.app.get(url(controller='files', |
058e2743e7b7
fixes issue #455 Creating an archive generates an exception on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2294
diff
changeset
|
229 action='archivefile', |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
230 repo_name=HG_REPO, |
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
231 fname=fname)) |
2255
95800dad44d0
fixes for tests on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2180
diff
changeset
|
232 response.mustcontain('Unknown revision') |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
233 |
1047 | 234 #========================================================================== |
235 # RAW FILE | |
236 #========================================================================== | |
237 def test_raw_file_ok(self): | |
238 self.log_user() | |
239 response = self.app.get(url(controller='files', action='rawfile', | |
240 repo_name=HG_REPO, | |
241 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', | |
242 f_path='vcs/nodes.py')) | |
1064
113a8db22852
file tests updates + extended the feed tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1063
diff
changeset
|
243 |
2255
95800dad44d0
fixes for tests on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2180
diff
changeset
|
244 self.assertEqual(response.content_disposition, "attachment; filename=nodes.py") |
95800dad44d0
fixes for tests on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2180
diff
changeset
|
245 self.assertEqual(response.content_type, "text/x-python") |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
246 |
1047 | 247 def test_raw_file_wrong_cs(self): |
248 self.log_user() | |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
249 rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc' |
1047 | 250 f_path = 'vcs/nodes.py' |
251 | |
252 response = self.app.get(url(controller='files', action='rawfile', | |
253 repo_name=HG_REPO, | |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
254 revision=rev, |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
255 f_path=f_path), status=404) |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
256 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
257 msg = """Such revision does not exist for this repository""" |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
258 response.mustcontain(msg) |
873
386fe4ce5f97
Added tests for archival, cleaned changelog test from prints
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
259 |
1047 | 260 def test_raw_file_wrong_f_path(self): |
261 self.log_user() | |
262 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' | |
263 f_path = 'vcs/ERRORnodes.py' | |
264 response = self.app.get(url(controller='files', action='rawfile', | |
265 repo_name=HG_REPO, | |
266 revision=rev, | |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
267 f_path=f_path), status=404) |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
268 |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
269 msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
270 response.mustcontain(msg) |
1047 | 271 |
272 #========================================================================== | |
1064
113a8db22852
file tests updates + extended the feed tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1063
diff
changeset
|
273 # RAW RESPONSE - PLAIN |
1047 | 274 #========================================================================== |
275 def test_raw_ok(self): | |
276 self.log_user() | |
277 response = self.app.get(url(controller='files', action='raw', | |
278 repo_name=HG_REPO, | |
279 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', | |
280 f_path='vcs/nodes.py')) | |
1064
113a8db22852
file tests updates + extended the feed tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1063
diff
changeset
|
281 |
2255
95800dad44d0
fixes for tests on Windows
Marcin Kuzminski <marcin@python-works.com>
parents:
2180
diff
changeset
|
282 self.assertEqual(response.content_type, "text/plain") |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
283 |
1047 | 284 def test_raw_wrong_cs(self): |
285 self.log_user() | |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
286 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc' |
1047 | 287 f_path = 'vcs/nodes.py' |
288 | |
289 response = self.app.get(url(controller='files', action='raw', | |
290 repo_name=HG_REPO, | |
1063
bbddef1e9ef2
fixes and extends file tests
Marcin Kuzminski <marcin@python-works.com>
parents:
1047
diff
changeset
|
291 revision=rev, |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
292 f_path=f_path), status=404) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
293 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
294 msg = """Such revision does not exist for this repository""" |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
295 response.mustcontain(msg) |
1047 | 296 |
297 def test_raw_wrong_f_path(self): | |
298 self.log_user() | |
299 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' | |
300 f_path = 'vcs/ERRORnodes.py' | |
301 response = self.app.get(url(controller='files', action='raw', | |
302 repo_name=HG_REPO, | |
303 revision=rev, | |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
304 f_path=f_path), status=404) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
305 msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
306 response.mustcontain(msg) |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1737
diff
changeset
|
307 |
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1737
diff
changeset
|
308 def test_ajaxed_files_list(self): |
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1737
diff
changeset
|
309 self.log_user() |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
310 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
311 response = self.app.get( |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
312 url('files_nodelist_home', repo_name=HG_REPO, f_path='/', |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
313 revision=rev), |
1984
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
314 extra_environ={'HTTP_X_PARTIAL_XHR': '1'}, |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
315 ) |
ed3b20284830
fixed tests after latest changes to history list
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
316 response.mustcontain("vcs/web/simplevcs/views/repository.py") |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
317 |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
318 #HG - ADD FILE |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
319 def test_add_file_view_hg(self): |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
320 self.log_user() |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
321 response = self.app.get(url('files_add_home', |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
322 repo_name=HG_REPO, |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
323 revision='tip', f_path='/')) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
324 |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
325 def test_add_file_into_hg_missing_content(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
326 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
327 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
328 repo_name=HG_REPO, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
329 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
330 params={ |
3849
b4fc29a051ae
small tests improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
3839
diff
changeset
|
331 'content': '' |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
332 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
333 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
334 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
335 self.checkSessionFlash(response, 'No content') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
336 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
337 def test_add_file_into_hg_missing_filename(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
338 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
339 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
340 repo_name=HG_REPO, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
341 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
342 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
343 'content': "foo" |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
344 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
345 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
346 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
347 self.checkSessionFlash(response, 'No filename') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
348 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
349 @parameterized.expand([ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
350 ('/abs', 'foo'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
351 ('../rel', 'foo'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
352 ('file/../foo', 'foo'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
353 ]) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
354 def test_add_file_into_hg_bad_filenames(self, location, filename): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
355 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
356 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
357 repo_name=HG_REPO, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
358 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
359 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
360 'content': "foo", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
361 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
362 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
363 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
364 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
365 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
366 self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
367 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
368 @parameterized.expand([ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
369 (1, '', 'foo.txt'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
370 (2, 'dir', 'foo.rst'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
371 (3, 'rel/dir', 'foo.bar'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
372 ]) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
373 def test_add_file_into_hg(self, cnt, location, filename): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
374 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
375 repo = fixture.create_repo('commit-test-%s' % cnt, repo_type='hg') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
376 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
377 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
378 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
379 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
380 'content': "foo", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
381 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
382 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
383 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
384 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
385 try: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
386 self.checkSessionFlash(response, 'Successfully committed to %s' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
387 % os.path.join(location, filename)) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
388 finally: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
389 fixture.destroy_repo(repo.repo_name) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
390 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
391 ##GIT - ADD FILE |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
392 def test_add_file_view_git(self): |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
393 self.log_user() |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
394 response = self.app.get(url('files_add_home', |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
395 repo_name=GIT_REPO, |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
396 revision='tip', f_path='/')) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
397 |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
398 def test_add_file_into_git_missing_content(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
399 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
400 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
401 repo_name=GIT_REPO, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
402 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
403 params={ |
3871
35bce50df618
fix syntax error for py <2.7
Marcin Kuzminski <marcin@python-works.com>
parents:
3849
diff
changeset
|
404 'content': '' |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
405 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
406 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
407 self.checkSessionFlash(response, 'No content') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
408 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
409 def test_add_file_into_git_missing_filename(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
410 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
411 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
412 repo_name=GIT_REPO, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
413 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
414 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
415 'content': "foo" |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
416 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
417 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
418 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
419 self.checkSessionFlash(response, 'No filename') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
420 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
421 @parameterized.expand([ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
422 ('/abs', 'foo'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
423 ('../rel', 'foo'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
424 ('file/../foo', 'foo'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
425 ]) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
426 def test_add_file_into_git_bad_filenames(self, location, filename): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
427 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
428 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
429 repo_name=GIT_REPO, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
430 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
431 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
432 'content': "foo", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
433 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
434 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
435 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
436 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
437 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
438 self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
439 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
440 @parameterized.expand([ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
441 (1, '', 'foo.txt'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
442 (2, 'dir', 'foo.rst'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
443 (3, 'rel/dir', 'foo.bar'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
444 ]) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
445 def test_add_file_into_git(self, cnt, location, filename): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
446 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
447 repo = fixture.create_repo('commit-test-%s' % cnt, repo_type='git') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
448 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
449 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
450 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
451 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
452 'content': "foo", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
453 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
454 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
455 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
456 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
457 try: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
458 self.checkSessionFlash(response, 'Successfully committed to %s' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
459 % os.path.join(location, filename)) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
460 finally: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
461 fixture.destroy_repo(repo.repo_name) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
462 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
463 #HG - EDIT |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
464 def test_edit_file_view_hg(self): |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
465 self.log_user() |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
466 response = self.app.get(url('files_edit_home', |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
467 repo_name=HG_REPO, |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
468 revision='tip', f_path='vcs/nodes.py')) |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
469 |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
470 def test_edit_file_view_not_on_branch_hg(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
471 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
472 repo = fixture.create_repo('test-edit-repo', repo_type='hg') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
473 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
474 ## add file |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
475 location = 'vcs' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
476 filename = 'nodes.py' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
477 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
478 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
479 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
480 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
481 'content': "def py():\n print 'hello'\n", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
482 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
483 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
484 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
485 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
486 response.follow() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
487 try: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
488 self.checkSessionFlash(response, 'Successfully committed to %s' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
489 % os.path.join(location, filename)) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
490 response = self.app.get(url('files_edit_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
491 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
492 revision='tip', f_path='vcs/nodes.py'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
493 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
494 self.checkSessionFlash(response, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
495 'You can only edit files with revision being a valid branch') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
496 finally: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
497 fixture.destroy_repo(repo.repo_name) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
498 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
499 def test_edit_file_view_commit_changes_hg(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
500 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
501 repo = fixture.create_repo('test-edit-repo', repo_type='hg') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
502 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
503 ## add file |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
504 location = 'vcs' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
505 filename = 'nodes.py' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
506 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
507 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
508 revision='tip', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
509 f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
510 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
511 'content': "def py():\n print 'hello'\n", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
512 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
513 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
514 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
515 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
516 response.follow() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
517 try: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
518 self.checkSessionFlash(response, 'Successfully committed to %s' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
519 % os.path.join(location, filename)) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
520 response = self.app.post(url('files_edit_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
521 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
522 revision=repo.scm_instance.DEFAULT_BRANCH_NAME, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
523 f_path='vcs/nodes.py'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
524 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
525 'content': "def py():\n print 'hello world'\n", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
526 'message': 'i commited', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
527 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
528 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
529 self.checkSessionFlash(response, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
530 'Successfully committed to vcs/nodes.py') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
531 finally: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
532 fixture.destroy_repo(repo.repo_name) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
533 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
534 #GIT - EDIT |
3621
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
535 def test_edit_file_view_git(self): |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
536 self.log_user() |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
537 response = self.app.get(url('files_edit_home', |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
538 repo_name=GIT_REPO, |
fe012b7df29d
missing files or bad files revisions should return 404s not redirects - ref #808
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
539 revision='tip', f_path='vcs/nodes.py')) |
3839
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
540 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
541 def test_edit_file_view_not_on_branch_git(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
542 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
543 repo = fixture.create_repo('test-edit-repo', repo_type='git') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
544 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
545 ## add file |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
546 location = 'vcs' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
547 filename = 'nodes.py' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
548 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
549 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
550 revision='tip', f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
551 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
552 'content': "def py():\n print 'hello'\n", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
553 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
554 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
555 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
556 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
557 response.follow() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
558 try: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
559 self.checkSessionFlash(response, 'Successfully committed to %s' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
560 % os.path.join(location, filename)) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
561 response = self.app.get(url('files_edit_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
562 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
563 revision='tip', f_path='vcs/nodes.py'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
564 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
565 self.checkSessionFlash(response, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
566 'You can only edit files with revision being a valid branch') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
567 finally: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
568 fixture.destroy_repo(repo.repo_name) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
569 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
570 def test_edit_file_view_commit_changes_git(self): |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
571 self.log_user() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
572 repo = fixture.create_repo('test-edit-repo', repo_type='git') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
573 |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
574 ## add file |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
575 location = 'vcs' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
576 filename = 'nodes.py' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
577 response = self.app.post(url('files_add_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
578 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
579 revision='tip', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
580 f_path='/'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
581 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
582 'content': "def py():\n print 'hello'\n", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
583 'filename': filename, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
584 'location': location |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
585 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
586 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
587 response.follow() |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
588 try: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
589 self.checkSessionFlash(response, 'Successfully committed to %s' |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
590 % os.path.join(location, filename)) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
591 response = self.app.post(url('files_edit_home', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
592 repo_name=repo.repo_name, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
593 revision=repo.scm_instance.DEFAULT_BRANCH_NAME, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
594 f_path='vcs/nodes.py'), |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
595 params={ |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
596 'content': "def py():\n print 'hello world'\n", |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
597 'message': 'i commited', |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
598 }, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
599 status=302) |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
600 self.checkSessionFlash(response, |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
601 'Successfully committed to vcs/nodes.py') |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
602 finally: |
9dec870411e0
Added more tests for web based file edit and add
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
603 fixture.destroy_repo(repo.repo_name) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
604 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
605 # HG - delete |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
606 def test_delete_file_view_hg(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
607 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
608 response = self.app.get(url('files_delete_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
609 repo_name=HG_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
610 revision='tip', f_path='vcs/nodes.py')) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
611 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
612 def test_delete_file_view_not_on_branch_hg(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
613 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
614 repo = fixture.create_repo('test-delete-repo', repo_type='hg') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
615 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
616 ## add file |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
617 location = 'vcs' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
618 filename = 'nodes.py' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
619 response = self.app.post(url('files_add_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
620 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
621 revision='tip', f_path='/'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
622 params={ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
623 'content': "def py():\n print 'hello'\n", |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
624 'filename': filename, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
625 'location': location |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
626 }, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
627 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
628 response.follow() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
629 try: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
630 self.checkSessionFlash(response, 'Successfully committed to %s' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
631 % os.path.join(location, filename)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
632 response = self.app.get(url('files_delete_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
633 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
634 revision='tip', f_path='vcs/nodes.py'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
635 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
636 self.checkSessionFlash(response, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
637 'You can only delete files with revision being a valid branch') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
638 finally: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
639 fixture.destroy_repo(repo.repo_name) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
640 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
641 def test_delete_file_view_commit_changes_hg(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
642 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
643 repo = fixture.create_repo('test-delete-repo', repo_type='hg') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
644 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
645 ## add file |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
646 location = 'vcs' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
647 filename = 'nodes.py' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
648 response = self.app.post(url('files_add_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
649 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
650 revision='tip', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
651 f_path='/'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
652 params={ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
653 'content': "def py():\n print 'hello'\n", |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
654 'filename': filename, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
655 'location': location |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
656 }, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
657 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
658 response.follow() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
659 try: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
660 self.checkSessionFlash(response, 'Successfully committed to %s' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
661 % os.path.join(location, filename)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
662 response = self.app.post(url('files_delete_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
663 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
664 revision=repo.scm_instance.DEFAULT_BRANCH_NAME, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
665 f_path='vcs/nodes.py'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
666 params={ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
667 'message': 'i commited', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
668 }, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
669 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
670 self.checkSessionFlash(response, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
671 'Successfully deleted file vcs/nodes.py') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
672 finally: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
673 fixture.destroy_repo(repo.repo_name) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
674 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
675 # GIT - delete |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
676 def test_delete_file_view_git(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
677 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
678 response = self.app.get(url('files_delete_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
679 repo_name=HG_REPO, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
680 revision='tip', f_path='vcs/nodes.py')) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
681 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
682 def test_delete_file_view_not_on_branch_git(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
683 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
684 repo = fixture.create_repo('test-delete-repo', repo_type='git') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
685 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
686 ## add file |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
687 location = 'vcs' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
688 filename = 'nodes.py' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
689 response = self.app.post(url('files_add_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
690 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
691 revision='tip', f_path='/'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
692 params={ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
693 'content': "def py():\n print 'hello'\n", |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
694 'filename': filename, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
695 'location': location |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
696 }, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
697 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
698 response.follow() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
699 try: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
700 self.checkSessionFlash(response, 'Successfully committed to %s' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
701 % os.path.join(location, filename)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
702 response = self.app.get(url('files_delete_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
703 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
704 revision='tip', f_path='vcs/nodes.py'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
705 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
706 self.checkSessionFlash(response, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
707 'You can only delete files with revision being a valid branch') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
708 finally: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
709 fixture.destroy_repo(repo.repo_name) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
710 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
711 def test_delete_file_view_commit_changes_git(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
712 self.log_user() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
713 repo = fixture.create_repo('test-delete-repo', repo_type='git') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
714 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
715 ## add file |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
716 location = 'vcs' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
717 filename = 'nodes.py' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
718 response = self.app.post(url('files_add_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
719 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
720 revision='tip', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
721 f_path='/'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
722 params={ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
723 'content': "def py():\n print 'hello'\n", |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
724 'filename': filename, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
725 'location': location |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
726 }, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
727 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
728 response.follow() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
729 try: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
730 self.checkSessionFlash(response, 'Successfully committed to %s' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
731 % os.path.join(location, filename)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
732 response = self.app.post(url('files_delete_home', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
733 repo_name=repo.repo_name, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
734 revision=repo.scm_instance.DEFAULT_BRANCH_NAME, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
735 f_path='vcs/nodes.py'), |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
736 params={ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
737 'message': 'i commited', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
738 }, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
739 status=302) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
740 self.checkSessionFlash(response, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
741 'Successfully deleted file vcs/nodes.py') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
742 finally: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3871
diff
changeset
|
743 fixture.destroy_repo(repo.repo_name) |