Show More
@@ -316,25 +316,24 b' def test_metatags_stylize(tag_data, expe' | |||
|
316 | 316 | def test_gravatar_url_builder(tmpl_url, email, expected, request_stub): |
|
317 | 317 | from rhodecode.lib.helpers import gravatar_url |
|
318 | 318 | |
|
319 | # mock pyramid.threadlocals | |
|
320 | def fake_get_current_request(): | |
|
321 | request_stub.scheme = 'https' | |
|
322 | request_stub.host = 'server.com' | |
|
323 | return request_stub | |
|
324 | ||
|
325 | # mock pylons.tmpl_context | |
|
326 | 319 | def fake_tmpl_context(_url): |
|
327 | 320 | _c = AttributeDict() |
|
328 | 321 | _c.visual = AttributeDict() |
|
329 | 322 | _c.visual.use_gravatar = True |
|
330 | 323 | _c.visual.gravatar_url = _url |
|
324 | return _c | |
|
331 | 325 | |
|
332 | return _c | |
|
326 | # mock pyramid.threadlocals | |
|
327 | def fake_get_current_request(): | |
|
328 | request_stub.scheme = 'https' | |
|
329 | request_stub.host = 'server.com' | |
|
330 | ||
|
331 | request_stub._call_context = fake_tmpl_context(tmpl_url) | |
|
332 | return request_stub | |
|
333 | 333 | |
|
334 | 334 | with mock.patch('rhodecode.lib.helpers.get_current_request', |
|
335 | 335 | fake_get_current_request): |
|
336 | fake = fake_tmpl_context(_url=tmpl_url) | |
|
337 | with mock.patch('pylons.tmpl_context', fake): | |
|
336 | ||
|
338 | 337 |
|
|
339 | 338 |
|
|
340 | 339 |
General Comments 0
You need to be logged in to leave comments.
Login now