Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.test import TestCase
- class FooTests(TestCase):
- def test_bar(self):
- self.client.get('/', HTTP_HOST='example.com')
- from django.test import TestCase
- from django.test.client import Client
- class MyClient(Client):
- HTTP_HOST = 'example.com'
- def get(self, *args, **kwargs):
- kwargs.setdefault('HTTP_HOST', self.HTTP_HOST)
- return super(MyClient, self).get(*args, **kwargs)
- class MyTestCase(TestCase):
- client_class = MyClient
- class FooTests(MyTestCase):
- def test_foo(self):
- self.client.get('/')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement