Show More
@@ -1,87 +1,87 b'' | |||
|
1 | 1 | import os |
|
2 | 2 | from paste.script.appinstall import AbstractInstallCommand |
|
3 | 3 | from paste.script.command import BadCommand |
|
4 | 4 | from paste.deploy import appconfig |
|
5 | 5 | |
|
6 | 6 | |
|
7 | 7 | class SetupCommand(AbstractInstallCommand): |
|
8 | 8 | |
|
9 | 9 | default_verbosity = 1 |
|
10 | 10 | max_args = 1 |
|
11 | 11 | min_args = 1 |
|
12 | 12 | summary = "Setup an application, given a config file" |
|
13 | 13 | usage = "CONFIG_FILE" |
|
14 | 14 | |
|
15 | 15 | description = """\ |
|
16 | 16 | Note: this is an experimental command, and it will probably change |
|
17 | 17 | in several ways by the next release. |
|
18 | 18 | |
|
19 | 19 | Setup an application according to its configuration file. This is |
|
20 | 20 | the second part of a two-phase web application installation |
|
21 | 21 | process (the first phase is prepare-app). The setup process may |
|
22 | 22 | consist of things like creating directories and setting up |
|
23 | 23 | databases. |
|
24 | 24 | """ |
|
25 | 25 | |
|
26 | 26 | parser = AbstractInstallCommand.standard_parser( |
|
27 | 27 | simulate=True, quiet=True, interactive=True) |
|
28 | 28 | parser.add_option('--user', |
|
29 | 29 | action='store', |
|
30 | 30 | dest='username', |
|
31 | 31 | default=None, |
|
32 | 32 | help='Admin Username') |
|
33 | 33 | parser.add_option('--email', |
|
34 | 34 | action='store', |
|
35 | 35 | dest='email', |
|
36 | 36 | default=None, |
|
37 | 37 | help='Admin Email') |
|
38 | 38 | parser.add_option('--password', |
|
39 | 39 | action='store', |
|
40 | 40 | dest='password', |
|
41 | 41 | default=None, |
|
42 | 42 | help='Admin password min 6 chars') |
|
43 | 43 | parser.add_option('--repos', |
|
44 | 44 | action='store', |
|
45 | 45 | dest='repos_location', |
|
46 | 46 | default=None, |
|
47 | 47 | help='Absolute path to repositories location') |
|
48 | 48 | parser.add_option('--name', |
|
49 | 49 | action='store', |
|
50 | 50 | dest='section_name', |
|
51 | 51 | default=None, |
|
52 | 52 | help='The name of the section to set up (default: app:main)') |
|
53 | 53 | |
|
54 | 54 | def command(self): |
|
55 | 55 | config_spec = self.args[0] |
|
56 | 56 | section = self.options.section_name |
|
57 | 57 | if section is None: |
|
58 | 58 | if '#' in config_spec: |
|
59 | 59 | config_spec, section = config_spec.split('#', 1) |
|
60 | 60 | else: |
|
61 | 61 | section = 'main' |
|
62 | 62 | if not ':' in section: |
|
63 | 63 | plain_section = section |
|
64 | 64 | section = 'app:'+section |
|
65 | 65 | else: |
|
66 | 66 | plain_section = section.split(':', 1)[0] |
|
67 | 67 | if not config_spec.startswith('config:'): |
|
68 | 68 | config_spec = 'config:' + config_spec |
|
69 | 69 | if plain_section != 'main': |
|
70 | 70 | config_spec += '#' + plain_section |
|
71 | 71 | config_file = config_spec[len('config:'):].split('#', 1)[0] |
|
72 | 72 | config_file = os.path.join(os.getcwd(), config_file) |
|
73 | 73 | self.logging_file_config(config_file) |
|
74 | 74 | conf = appconfig(config_spec, relative_to=os.getcwd()) |
|
75 | 75 | ep_name = conf.context.entry_point_name |
|
76 | 76 | ep_group = conf.context.protocol |
|
77 | 77 | dist = conf.context.distribution |
|
78 | 78 | if dist is None: |
|
79 | 79 | raise BadCommand( |
|
80 | 80 | "The section %r is not the application (probably a filter). " |
|
81 | 81 | "You should add #section_name, where section_name is the " |
|
82 | 82 | "section that configures your application" % plain_section) |
|
83 | 83 | installer = self.get_installer(dist, ep_group, ep_name) |
|
84 | 84 | installer.setup_config( |
|
85 | 85 | self, config_file, section, self.sysconfig_install_vars(installer)) |
|
86 | 86 | self.call_sysconfig_functions( |
|
87 | 'post_setup_hook', installer, config_file) No newline at end of file | |
|
87 | 'post_setup_hook', installer, config_file) |
@@ -1,318 +1,318 b'' | |||
|
1 | 1 | from rhodecode.tests import * |
|
2 | 2 | |
|
3 | 3 | ARCHIVE_SPECS = { |
|
4 | 4 | '.tar.bz2': ('application/x-bzip2', 'tbz2', ''), |
|
5 | 5 | '.tar.gz': ('application/x-gzip', 'tgz', ''), |
|
6 | 6 | '.zip': ('application/zip', 'zip', ''), |
|
7 | 7 | } |
|
8 | 8 | |
|
9 | 9 | |
|
10 | 10 | class TestFilesController(TestController): |
|
11 | 11 | |
|
12 | 12 | def test_index(self): |
|
13 | 13 | self.log_user() |
|
14 | 14 | response = self.app.get(url(controller='files', action='index', |
|
15 | 15 | repo_name=HG_REPO, |
|
16 | 16 | revision='tip', |
|
17 | 17 | f_path='/')) |
|
18 | 18 | # Test response... |
|
19 | 19 | response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/docs">docs</a>') |
|
20 | 20 | response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/tests">tests</a>') |
|
21 | 21 | response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/vcs">vcs</a>') |
|
22 | 22 | response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/.hgignore">.hgignore</a>') |
|
23 | 23 | response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/MANIFEST.in">MANIFEST.in</a>') |
|
24 | 24 | |
|
25 | 25 | def test_index_revision(self): |
|
26 | 26 | self.log_user() |
|
27 | 27 | |
|
28 | 28 | response = self.app.get( |
|
29 | 29 | url(controller='files', action='index', |
|
30 | 30 | repo_name=HG_REPO, |
|
31 | 31 | revision='7ba66bec8d6dbba14a2155be32408c435c5f4492', |
|
32 | 32 | f_path='/') |
|
33 | 33 | ) |
|
34 | 34 | |
|
35 | 35 | #Test response... |
|
36 | 36 | |
|
37 | 37 | response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>') |
|
38 | 38 | response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>') |
|
39 | 39 | response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>') |
|
40 | 40 | response.mustcontain('1.1 KiB') |
|
41 | 41 | response.mustcontain('text/x-python') |
|
42 | 42 | |
|
43 | 43 | def test_index_different_branch(self): |
|
44 | 44 | self.log_user() |
|
45 | 45 | |
|
46 | 46 | response = self.app.get(url(controller='files', action='index', |
|
47 | 47 | repo_name=HG_REPO, |
|
48 | 48 | revision='97e8b885c04894463c51898e14387d80c30ed1ee', |
|
49 | 49 | f_path='/')) |
|
50 | 50 | |
|
51 | 51 | response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: git</a></span>""") |
|
52 | 52 | |
|
53 | 53 | def test_index_paging(self): |
|
54 | 54 | self.log_user() |
|
55 | 55 | |
|
56 | 56 | for r in [(73, 'a066b25d5df7016b45a41b7e2a78c33b57adc235'), |
|
57 | 57 | (92, 'cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e'), |
|
58 | 58 | (109, '75feb4c33e81186c87eac740cee2447330288412'), |
|
59 | 59 | (1, '3d8f361e72ab303da48d799ff1ac40d5ac37c67e'), |
|
60 | 60 | (0, 'b986218ba1c9b0d6a259fac9b050b1724ed8e545')]: |
|
61 | 61 | |
|
62 | 62 | response = self.app.get(url(controller='files', action='index', |
|
63 | 63 | repo_name=HG_REPO, |
|
64 | 64 | revision=r[1], |
|
65 | 65 | f_path='/')) |
|
66 | 66 | |
|
67 | 67 | response.mustcontain("""@ r%s:%s""" % (r[0], r[1][:12])) |
|
68 | 68 | |
|
69 | 69 | def test_file_source(self): |
|
70 | 70 | self.log_user() |
|
71 | 71 | response = self.app.get(url(controller='files', action='index', |
|
72 | 72 | repo_name=HG_REPO, |
|
73 | 73 | revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', |
|
74 | 74 | f_path='vcs/nodes.py')) |
|
75 | 75 | |
|
76 | 76 | #test or history |
|
77 | 77 | response.mustcontain("""<optgroup label="Changesets"> |
|
78 | 78 | <option value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option> |
|
79 | 79 | <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35 (default)</option> |
|
80 | 80 | <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c (default)</option> |
|
81 | 81 | <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329 (default)</option> |
|
82 | 82 | <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf (git)</option> |
|
83 | 83 | <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81 (default)</option> |
|
84 | 84 | <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc (default)</option> |
|
85 | 85 | <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21 (default)</option> |
|
86 | 86 | <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2 (default)</option> |
|
87 | 87 | <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85 (default)</option> |
|
88 | 88 | <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2 (git)</option> |
|
89 | 89 | <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93 (default)</option> |
|
90 | 90 | <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b (default)</option> |
|
91 | 91 | <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455 (default)</option> |
|
92 | 92 | <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32 (default)</option> |
|
93 | 93 | <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0 (default)</option> |
|
94 | 94 | <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081 (default)</option> |
|
95 | 95 | <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad (default)</option> |
|
96 | 96 | <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7 (default)</option> |
|
97 | 97 | <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059 (web)</option> |
|
98 | 98 | <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb (web)</option> |
|
99 | 99 | <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1 (web)</option> |
|
100 | 100 | <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71 (web)</option> |
|
101 | 101 | <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771 (web)</option> |
|
102 | 102 | <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526 (web)</option> |
|
103 | 103 | <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4 (web)</option> |
|
104 | 104 | <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b (web)</option> |
|
105 | 105 | <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c (web)</option> |
|
106 | 106 | <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1 (default)</option> |
|
107 | 107 | <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5 (default)</option> |
|
108 | 108 | <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283 (default)</option> |
|
109 | 109 | <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6 (default)</option> |
|
110 | 110 | <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3 (default)</option> |
|
111 | 111 | </optgroup> |
|
112 | 112 | <optgroup label="Branches"> |
|
113 | 113 | <option selected="selected" value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">default</option> |
|
114 | 114 | <option value="97e8b885c04894463c51898e14387d80c30ed1ee">git</option> |
|
115 | 115 | <option value="2e6a2bf9356ca56df08807f4ad86d480da72a8f4">web</option> |
|
116 | 116 | </optgroup> |
|
117 | 117 | <optgroup label="Tags"> |
|
118 | 118 | <option selected="selected" value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">tip</option> |
|
119 | 119 | <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">0.1.4</option> |
|
120 | 120 | <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">0.1.3</option> |
|
121 | 121 | <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">0.1.2</option> |
|
122 | 122 | <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">0.1.1</option> |
|
123 | 123 | </optgroup> |
|
124 | 124 | """) |
|
125 | 125 | |
|
126 | 126 | response.mustcontain("""<div class="commit">merge</div>""") |
|
127 | 127 | |
|
128 | 128 | response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""") |
|
129 | 129 | |
|
130 | 130 | def test_file_annotation(self): |
|
131 | 131 | self.log_user() |
|
132 | 132 | response = self.app.get(url(controller='files', action='index', |
|
133 | 133 | repo_name=HG_REPO, |
|
134 | 134 | revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', |
|
135 | 135 | f_path='vcs/nodes.py', |
|
136 | 136 | annotate=True)) |
|
137 | 137 | |
|
138 | 138 | |
|
139 | 139 | response.mustcontain("""<optgroup label="Changesets"> |
|
140 | 140 | <option value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option> |
|
141 | 141 | <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35 (default)</option> |
|
142 | 142 | <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c (default)</option> |
|
143 | 143 | <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329 (default)</option> |
|
144 | 144 | <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf (git)</option> |
|
145 | 145 | <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81 (default)</option> |
|
146 | 146 | <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc (default)</option> |
|
147 | 147 | <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21 (default)</option> |
|
148 | 148 | <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2 (default)</option> |
|
149 | 149 | <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85 (default)</option> |
|
150 | 150 | <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2 (git)</option> |
|
151 | 151 | <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93 (default)</option> |
|
152 | 152 | <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b (default)</option> |
|
153 | 153 | <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455 (default)</option> |
|
154 | 154 | <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32 (default)</option> |
|
155 | 155 | <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0 (default)</option> |
|
156 | 156 | <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081 (default)</option> |
|
157 | 157 | <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad (default)</option> |
|
158 | 158 | <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7 (default)</option> |
|
159 | 159 | <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059 (web)</option> |
|
160 | 160 | <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb (web)</option> |
|
161 | 161 | <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1 (web)</option> |
|
162 | 162 | <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71 (web)</option> |
|
163 | 163 | <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771 (web)</option> |
|
164 | 164 | <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526 (web)</option> |
|
165 | 165 | <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4 (web)</option> |
|
166 | 166 | <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b (web)</option> |
|
167 | 167 | <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c (web)</option> |
|
168 | 168 | <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1 (default)</option> |
|
169 | 169 | <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5 (default)</option> |
|
170 | 170 | <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283 (default)</option> |
|
171 | 171 | <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6 (default)</option> |
|
172 | 172 | <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3 (default)</option> |
|
173 | 173 | </optgroup> |
|
174 | 174 | <optgroup label="Branches"> |
|
175 | 175 | <option selected="selected" value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">default</option> |
|
176 | 176 | <option value="97e8b885c04894463c51898e14387d80c30ed1ee">git</option> |
|
177 | 177 | <option value="2e6a2bf9356ca56df08807f4ad86d480da72a8f4">web</option> |
|
178 | 178 | </optgroup> |
|
179 | 179 | <optgroup label="Tags"> |
|
180 | 180 | <option selected="selected" value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">tip</option> |
|
181 | 181 | <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">0.1.4</option> |
|
182 | 182 | <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">0.1.3</option> |
|
183 | 183 | <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">0.1.2</option> |
|
184 | 184 | <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">0.1.1</option> |
|
185 | 185 | </optgroup>""") |
|
186 | 186 | |
|
187 | 187 | response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""") |
|
188 | 188 | |
|
189 | 189 | def test_archival(self): |
|
190 | 190 | self.log_user() |
|
191 | 191 | |
|
192 | 192 | for arch_ext, info in ARCHIVE_SPECS.items(): |
|
193 | 193 | short = '27cd5cce30c9%s' % arch_ext |
|
194 | 194 | fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext |
|
195 | 195 | filename = '%s-%s' % (HG_REPO, short) |
|
196 |
response = self.app.get(url(controller='files', |
|
|
196 | response = self.app.get(url(controller='files', | |
|
197 | 197 | action='archivefile', |
|
198 | 198 | repo_name=HG_REPO, |
|
199 | 199 | fname=fname)) |
|
200 | 200 | |
|
201 | 201 | self.assertEqual(response.status, '200 OK') |
|
202 | 202 | self.assertEqual(response.response._headers.items(), |
|
203 | 203 | [('Pragma', 'no-cache'), |
|
204 | 204 | ('Cache-Control', 'no-cache'), |
|
205 | 205 | ('Content-Type', '%s; charset=utf-8' % info[0]), |
|
206 | 206 | ('Content-Disposition', 'attachment; filename=%s' % filename), |
|
207 | 207 | ] |
|
208 | 208 | ) |
|
209 | 209 | |
|
210 | 210 | def test_archival_wrong_ext(self): |
|
211 | 211 | self.log_user() |
|
212 | 212 | |
|
213 | 213 | for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']: |
|
214 | 214 | fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext |
|
215 | 215 | |
|
216 | 216 | response = self.app.get(url(controller='files', action='archivefile', |
|
217 | 217 | repo_name=HG_REPO, |
|
218 | 218 | fname=fname)) |
|
219 | 219 | response.mustcontain('Unknown archive type') |
|
220 | 220 | |
|
221 | 221 | def test_archival_wrong_revision(self): |
|
222 | 222 | self.log_user() |
|
223 | 223 | |
|
224 | 224 | for rev in ['00x000000', 'tar', 'wrong', '@##$@$424213232', '232dffcd']: |
|
225 | 225 | fname = '%s.zip' % rev |
|
226 | 226 | |
|
227 | 227 | response = self.app.get(url(controller='files', action='archivefile', |
|
228 | 228 | repo_name=HG_REPO, |
|
229 | 229 | fname=fname)) |
|
230 | 230 | response.mustcontain('Unknown revision') |
|
231 | 231 | |
|
232 | 232 | #========================================================================== |
|
233 | 233 | # RAW FILE |
|
234 | 234 | #========================================================================== |
|
235 | 235 | def test_raw_file_ok(self): |
|
236 | 236 | self.log_user() |
|
237 | 237 | response = self.app.get(url(controller='files', action='rawfile', |
|
238 | 238 | repo_name=HG_REPO, |
|
239 | 239 | revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', |
|
240 | 240 | f_path='vcs/nodes.py')) |
|
241 | 241 | |
|
242 | 242 | self.assertEqual(response.content_disposition, "attachment; filename=nodes.py") |
|
243 | 243 | self.assertEqual(response.content_type, "text/x-python") |
|
244 | 244 | |
|
245 | 245 | def test_raw_file_wrong_cs(self): |
|
246 | 246 | self.log_user() |
|
247 | 247 | rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc' |
|
248 | 248 | f_path = 'vcs/nodes.py' |
|
249 | 249 | |
|
250 | 250 | response = self.app.get(url(controller='files', action='rawfile', |
|
251 | 251 | repo_name=HG_REPO, |
|
252 | 252 | revision=rev, |
|
253 | 253 | f_path=f_path)) |
|
254 | 254 | |
|
255 | 255 | msg = """Revision %r does not exist for this repository""" % (rev) |
|
256 | 256 | self.checkSessionFlash(response, msg) |
|
257 | 257 | |
|
258 | 258 | msg = """%s""" % (HG_REPO) |
|
259 | 259 | self.checkSessionFlash(response, msg) |
|
260 | 260 | |
|
261 | 261 | def test_raw_file_wrong_f_path(self): |
|
262 | 262 | self.log_user() |
|
263 | 263 | rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
|
264 | 264 | f_path = 'vcs/ERRORnodes.py' |
|
265 | 265 | response = self.app.get(url(controller='files', action='rawfile', |
|
266 | 266 | repo_name=HG_REPO, |
|
267 | 267 | revision=rev, |
|
268 | 268 | f_path=f_path)) |
|
269 | 269 | |
|
270 | 270 | msg = "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) |
|
271 | 271 | self.checkSessionFlash(response, msg) |
|
272 | 272 | |
|
273 | 273 | #========================================================================== |
|
274 | 274 | # RAW RESPONSE - PLAIN |
|
275 | 275 | #========================================================================== |
|
276 | 276 | def test_raw_ok(self): |
|
277 | 277 | self.log_user() |
|
278 | 278 | response = self.app.get(url(controller='files', action='raw', |
|
279 | 279 | repo_name=HG_REPO, |
|
280 | 280 | revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', |
|
281 | 281 | f_path='vcs/nodes.py')) |
|
282 | 282 | |
|
283 | 283 | self.assertEqual(response.content_type, "text/plain") |
|
284 | 284 | |
|
285 | 285 | def test_raw_wrong_cs(self): |
|
286 | 286 | self.log_user() |
|
287 | 287 | rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc' |
|
288 | 288 | f_path = 'vcs/nodes.py' |
|
289 | 289 | |
|
290 | 290 | response = self.app.get(url(controller='files', action='raw', |
|
291 | 291 | repo_name=HG_REPO, |
|
292 | 292 | revision=rev, |
|
293 | 293 | f_path=f_path)) |
|
294 | 294 | msg = """Revision %r does not exist for this repository""" % (rev) |
|
295 | 295 | self.checkSessionFlash(response, msg) |
|
296 | 296 | |
|
297 | 297 | msg = """%s""" % (HG_REPO) |
|
298 | 298 | self.checkSessionFlash(response, msg) |
|
299 | 299 | |
|
300 | 300 | def test_raw_wrong_f_path(self): |
|
301 | 301 | self.log_user() |
|
302 | 302 | rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
|
303 | 303 | f_path = 'vcs/ERRORnodes.py' |
|
304 | 304 | response = self.app.get(url(controller='files', action='raw', |
|
305 | 305 | repo_name=HG_REPO, |
|
306 | 306 | revision=rev, |
|
307 | 307 | f_path=f_path)) |
|
308 | 308 | msg = "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) |
|
309 | 309 | self.checkSessionFlash(response, msg) |
|
310 | 310 | |
|
311 | 311 | def test_ajaxed_files_list(self): |
|
312 | 312 | self.log_user() |
|
313 | 313 | rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
|
314 | 314 | response = self.app.get( |
|
315 | 315 | url('files_nodelist_home', repo_name=HG_REPO,f_path='/',revision=rev), |
|
316 | 316 | extra_environ={'HTTP_X_PARTIAL_XHR': '1'}, |
|
317 | 317 | ) |
|
318 | 318 | response.mustcontain("vcs/web/simplevcs/views/repository.py") |
@@ -1,103 +1,103 b'' | |||
|
1 | 1 | import sys |
|
2 | 2 | from rhodecode import get_version |
|
3 | 3 | from rhodecode import __license__ |
|
4 | 4 | from rhodecode import __py_version__ |
|
5 | 5 | from rhodecode import requirements |
|
6 | 6 | |
|
7 | 7 | if __py_version__ < (2, 5): |
|
8 | 8 | raise Exception('RhodeCode requires python 2.5 or later') |
|
9 | 9 | |
|
10 | 10 | dependency_links = [ |
|
11 | 11 | ] |
|
12 | 12 | |
|
13 | 13 | classifiers = [ |
|
14 | 14 | 'Development Status :: 4 - Beta', |
|
15 | 15 | 'Environment :: Web Environment', |
|
16 | 16 | 'Framework :: Pylons', |
|
17 | 17 | 'Intended Audience :: Developers', |
|
18 | 18 | 'License :: OSI Approved :: GNU General Public License (GPL)', |
|
19 | 19 | 'Operating System :: OS Independent', |
|
20 | 20 | 'Programming Language :: Python', |
|
21 | 21 | 'Programming Language :: Python :: 2.5', |
|
22 | 22 | 'Programming Language :: Python :: 2.6', |
|
23 | 23 | 'Programming Language :: Python :: 2.7', |
|
24 | 24 | ] |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | # additional files from project that goes somewhere in the filesystem |
|
28 | 28 | # relative to sys.prefix |
|
29 | 29 | data_files = [] |
|
30 | 30 | |
|
31 | 31 | # additional files that goes into package itself |
|
32 | 32 | package_data = {'rhodecode': ['i18n/*/LC_MESSAGES/*.mo', ], } |
|
33 | 33 | |
|
34 | 34 | description = ('Mercurial repository browser/management with ' |
|
35 | 35 | 'build in push/pull server and full text search') |
|
36 | 36 | keywords = ' '.join(['rhodecode', 'rhodiumcode', 'mercurial', 'git', |
|
37 | 37 | 'code review', 'repo groups', 'ldap' |
|
38 | 38 | 'repository management', 'hgweb replacement' |
|
39 | 39 | 'hgwebdir', 'gitweb replacement', 'serving hgweb', ]) |
|
40 | 40 | # long description |
|
41 | 41 | try: |
|
42 | 42 | readme_file = 'README.rst' |
|
43 | 43 | changelog_file = 'docs/changelog.rst' |
|
44 | 44 | long_description = open(readme_file).read() + '\n\n' + \ |
|
45 | 45 | open(changelog_file).read() |
|
46 | 46 | |
|
47 | 47 | except IOError, err: |
|
48 | 48 | sys.stderr.write("[WARNING] Cannot find file specified as " |
|
49 | 49 | "long_description (%s)\n or changelog (%s) skipping that file" \ |
|
50 | 50 | % (readme_file, changelog_file)) |
|
51 | 51 | long_description = description |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | try: |
|
55 | 55 | from setuptools import setup, find_packages |
|
56 | 56 | except ImportError: |
|
57 | 57 | from ez_setup import use_setuptools |
|
58 | 58 | use_setuptools() |
|
59 | 59 | from setuptools import setup, find_packages |
|
60 | 60 | # packages |
|
61 | 61 | packages = find_packages(exclude=['ez_setup']) |
|
62 | 62 | |
|
63 | 63 | setup( |
|
64 | 64 | name='RhodeCode', |
|
65 | 65 | version=get_version(), |
|
66 | 66 | description=description, |
|
67 | 67 | long_description=long_description, |
|
68 | 68 | keywords=keywords, |
|
69 | 69 | license=__license__, |
|
70 | 70 | author='Marcin Kuzminski', |
|
71 | 71 | author_email='marcin@python-works.com', |
|
72 | 72 | dependency_links=dependency_links, |
|
73 | 73 | url='http://rhodecode.org', |
|
74 | 74 | install_requires=requirements, |
|
75 | 75 | classifiers=classifiers, |
|
76 | 76 | setup_requires=["PasteScript>=1.6.3"], |
|
77 | 77 | data_files=data_files, |
|
78 | 78 | packages=packages, |
|
79 | 79 | include_package_data=True, |
|
80 | 80 | test_suite='nose.collector', |
|
81 | 81 | package_data=package_data, |
|
82 | 82 | message_extractors={'rhodecode': [ |
|
83 | 83 | ('**.py', 'python', None), |
|
84 | 84 | ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}), |
|
85 | 85 | ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}), |
|
86 | 86 | ('public/**', 'ignore', None)]}, |
|
87 | 87 | zip_safe=False, |
|
88 | 88 | paster_plugins=['PasteScript', 'Pylons'], |
|
89 | 89 | entry_points=""" |
|
90 | 90 | [paste.app_factory] |
|
91 | 91 | main = rhodecode.config.middleware:make_app |
|
92 | 92 | |
|
93 | 93 | [paste.app_install] |
|
94 | 94 | main = pylons.util:PylonsInstaller |
|
95 | 95 | |
|
96 | 96 | [paste.global_paster_command] |
|
97 | setup-rhodecode=rhodecode.config.setup:SetupCommand | |
|
97 | setup-rhodecode=rhodecode.config.setup_rhodecode:SetupCommand | |
|
98 | 98 | make-index=rhodecode.lib.indexers:MakeIndex |
|
99 | 99 | make-rcext=rhodecode.config.rcextensions.make_rcextensions:MakeRcExt |
|
100 | 100 | upgrade-db=rhodecode.lib.dbmigrate:UpgradeDb |
|
101 | 101 | celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand |
|
102 | 102 | """, |
|
103 | 103 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now