Skip to content
Snippets Groups Projects
Commit d9219b55 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

test context processor

parent 6329eb3a
No related branches found
No related tags found
No related merge requests found
Pipeline #150884 failed
......@@ -47,9 +47,6 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'basetheme_bootstrap.context_processors.processors',
'strass_app.context_processors.enrich_with_status',
'strass_app.context_processors.add_google_analytics_tracker',
"live_settings.context_processors.processors",
],
},
......
{%if live_settings.blabla__int == 0 %}
IS_0
{%else%}
IS_NONE
{%endif%}
\ No newline at end of file
import logging
from django.test import TestCase as DjangoTestCase
from django.urls import reverse
from live_settings import live_settings
logger = logging.getLogger(__name__)
class LiveSettingsTestCase(DjangoTestCase):
def test_view_works(self):
url = reverse('foo')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertIn("IS_NONE", str(response.content))
self.assertNotIn("IS_0", str(response.content))
live_settings.blabla=0
response = self.client.get(url)
self.assertIn("IS_0", str(response.content))
self.assertNotIn("IS_NONE", str(response.content))
\ No newline at end of file
from django.urls import path, include
from django.views.generic import TemplateView
urlpatterns = [
path('live_settings/', include("live_settings.urls")),
path('foo/', TemplateView.as_view(template_name='tests/foo.html'), name='foo'),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment