mirror of
https://github.com/jazzband/django-defender.git
synced 2026-03-16 22:10:32 +00:00
added test for remove_prefix method
This commit is contained in:
parent
428968b238
commit
d90dfa8db7
1 changed files with 7 additions and 0 deletions
|
|
@ -1169,3 +1169,10 @@ class TestUtils(DefenderTestCase):
|
|||
req = HttpRequest()
|
||||
req.META["HTTP_X_FORWARDED_FOR"] = "[2001:db8::1]:123456"
|
||||
self.assertEqual(utils.get_ip(req), "2001:db8::1")
|
||||
|
||||
def test_remove_prefix(self):
|
||||
""" test the remove_prefix() method """
|
||||
self.assertEqual(utils.remove_prefix(
|
||||
"defender:blocked:ip:192.168.24.24", "defender:blocked:"), "ip:192.168.24.24")
|
||||
self.assertEqual(utils.remove_prefix(
|
||||
"defender:blocked:username:johndoe", "defender:blocked:"), "username:johndoe")
|
||||
|
|
|
|||
Loading…
Reference in a new issue