Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

src/d/j/django-templation-HEAD/tests/tests/test_templatetags.py   django-templation(Download)
from django.http import HttpRequest
from django.template import TemplateSyntaxError
from templation.templatetags.templation_tags import static, get_model_info, is_trusted_request
from templation.locals import thread_locals
 
        request.META['REMOTE_ADDR'] = '127.0.0.1'
        context = {'request': request}
        self.assertTrue(is_trusted_request(context))
        user.is_active = False
        self.assertFalse(is_trusted_request(context))
        user.is_active = True
        user.is_staff = False
        self.assertFalse(is_trusted_request(context))
        request.META['REMOTE_ADDR'] = '1.2.3.4'
        self.assertFalse(is_trusted_request(context))