fnp
/
fnpdjango.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Support for Django up to 2.2.
[fnpdjango.git]
/
tests
/
tests
/
test_middleware.py
1
from django.test import TestCase
2
3
4
class MiddlewareTests(TestCase):
5
def test_realip(self):
6
self.assertEqual(
7
self.client.get('/ip/').content.decode('latin1'),
8
'127.0.0.1'
9
)
10
self.assertEqual(
11
self.client.get(
12
'/ip/',
13
HTTP_X_REAL_IP='1.2.3.4'
14
).content.decode('latin1'),
15
'1.2.3.4'
16
)