164 |
164 |
{'url': url}) == 'http://www.example.net/foobar'
|
165 |
165 |
assert get_variadic_url('[url]/foobar/',
|
166 |
166 |
{'url': url}) == 'http://www.example.net/foobar/'
|
|
167 |
assert get_variadic_url('{{url}}/foobar/',
|
|
168 |
{'url': url}) == 'http://www.example.net/foobar/'
|
167 |
169 |
assert get_variadic_url('[url]foo/bar/',
|
168 |
170 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foo/bar/'
|
169 |
171 |
assert get_variadic_url('[url]foobar/',
|
... | ... | |
174 |
176 |
assert get_variadic_url('{{ url }}/foobar',
|
175 |
177 |
{'url': 'http://www.example.net'}) == 'http://www.example.net/foobar'
|
176 |
178 |
assert get_variadic_url('{{ url }}/foobar', # Django is more conservative here:
|
177 |
|
{'url': 'http://www.example.net/'}) == 'http://www.example.net//foobar'
|
|
179 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar'
|
178 |
180 |
# to be "smart", use Django templates language:
|
179 |
181 |
for url in ('http://www.example.net', 'http://www.example.net/'):
|
180 |
182 |
assert get_variadic_url('{{ url }}{% if url|last != "/" %}/{% endif %}foobar',
|
... | ... | |
207 |
209 |
assert get_variadic_url('{{ url }}/?foo=bar',
|
208 |
210 |
{'url': 'http://www.example.net'}) == 'http://www.example.net/?foo=bar'
|
209 |
211 |
assert get_variadic_url('{{ url }}/?foo=bar',
|
210 |
|
{'url': 'http://www.example.net/'}) == 'http://www.example.net//?foo=bar'
|
|
212 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/?foo=bar'
|
211 |
213 |
|
212 |
214 |
|
213 |
215 |
def test_url_server_more(pub):
|
... | ... | |
222 |
224 |
assert get_variadic_url('{{ url }}/foobar/json?toto',
|
223 |
225 |
{'url': 'http://www.example.net'}) == 'http://www.example.net/foobar/json?toto'
|
224 |
226 |
assert get_variadic_url('{{ url }}/foobar/json?toto',
|
225 |
|
{'url': 'http://www.example.net/'}) == 'http://www.example.net//foobar/json?toto'
|
|
227 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/json?toto'
|
226 |
228 |
assert get_variadic_url('{{ url }}foobar/json?toto',
|
227 |
229 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/json?toto'
|
228 |
230 |
|
... | ... | |
239 |
241 |
assert get_variadic_url('{{ url }}/foobar/json?foo=bar',
|
240 |
242 |
{'url': 'http://www.example.net'}) == 'http://www.example.net/foobar/json?foo=bar'
|
241 |
243 |
assert get_variadic_url('{{ url }}/foobar/json?foo=bar',
|
242 |
|
{'url': 'http://www.example.net/'}) == 'http://www.example.net//foobar/json?foo=bar'
|
|
244 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/json?foo=bar'
|
243 |
245 |
assert get_variadic_url('{{ url }}foobar/json?foo=bar',
|
244 |
246 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/json?foo=bar'
|
245 |
247 |
|
... | ... | |
249 |
251 |
{'url': 'http://www.example.net'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
|
250 |
252 |
assert get_variadic_url('[url]/foobar/baz/json?foo=bar',
|
251 |
253 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
|
252 |
|
assert get_variadic_url('[url]foobar/baz/json?foo=bar',
|
253 |
|
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
|
254 |
254 |
|
255 |
255 |
# Django is more conservative
|
256 |
256 |
assert get_variadic_url('{{ url }}/foobar/baz/json?foo=bar',
|
257 |
257 |
{'url': 'http://www.example.net'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
|
258 |
258 |
assert get_variadic_url('{{ url }}/foobar/baz/json?foo=bar',
|
259 |
|
{'url': 'http://www.example.net/'}) == 'http://www.example.net//foobar/baz/json?foo=bar'
|
|
259 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
|
260 |
260 |
assert get_variadic_url('{{ url }}foobar/baz/json?foo=bar',
|
261 |
261 |
{'url': 'http://www.example.net/'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
|
262 |
262 |
|