##// END OF EJS Templates
tests: remove usage of pylons context var in home app test.
marcink -
r1893:eb462cc2 default
parent child Browse files
Show More
@@ -54,14 +54,15 b' class TestHomeController(TestController)'
54 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
54 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
55
55
56 def test_index_contains_statics_with_ver(self):
56 def test_index_contains_statics_with_ver(self):
57 from pylons import tmpl_context as c
57 from rhodecode.lib.base import calculate_version_hash
58
58
59 self.log_user()
59 self.log_user()
60 response = self.app.get(route_path('home'))
60 response = self.app.get(route_path('home'))
61
61
62 rhodecode_version_hash = c.rhodecode_version_hash
62 rhodecode_version_hash = calculate_version_hash()
63 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
63 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
64 response.mustcontain('rhodecode-components.js?ver={0}'.format(rhodecode_version_hash))
64 response.mustcontain('rhodecode-components.js?ver={0}'.format(
65 rhodecode_version_hash))
65
66
66 def test_index_contains_backend_specific_details(self, backend):
67 def test_index_contains_backend_specific_details(self, backend):
67 self.log_user()
68 self.log_user()
@@ -266,6 +266,12 b' class BasicAuth(AuthBasicAuthenticator):'
266
266
267
267
268 def attach_context_attributes(context, request, user_id, attach_to_request=False):
268 def attach_context_attributes(context, request, user_id, attach_to_request=False):
269 def calculate_version_hash():
270 return md5(
271 config.get('beaker.session.secret', '') +
272 rhodecode.__version__)[:8]
273
274
269 """
275 """
270 Attach variables into template context called `c`, please note that
276 Attach variables into template context called `c`, please note that
271 request could be pylons or pyramid request in here.
277 request could be pylons or pyramid request in here.
@@ -275,9 +281,7 b' def attach_context_attributes(context, r'
275 context.rhodecode_version = rhodecode.__version__
281 context.rhodecode_version = rhodecode.__version__
276 context.rhodecode_edition = config.get('rhodecode.edition')
282 context.rhodecode_edition = config.get('rhodecode.edition')
277 # unique secret + version does not leak the version but keep consistency
283 # unique secret + version does not leak the version but keep consistency
278 context.rhodecode_version_hash = md5(
284 context.rhodecode_version_hash = calculate_version_hash()
279 config.get('beaker.session.secret', '') +
280 rhodecode.__version__)[:8]
281
285
282 # Default language set for the incoming request
286 # Default language set for the incoming request
283 context.language = translation.get_lang()[0]
287 context.language = translation.get_lang()[0]
General Comments 0
You need to be logged in to leave comments. Login now