From 7da91fe2fc52d098055085bf21533dc592fd6bcd Mon Sep 17 00:00:00 2001
From: Ram Rachum <ram@rachum.com>
Date: Fri, 22 Mar 2013 01:08:41 +0200
Subject: [PATCH] Tests for user agent input to `is_ignorable_404`
---
tests/middleware/tests.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py
index f2f7f4d..32e7b98 100644
a
|
b
|
from io import BytesIO
|
6 | 6 | import random |
7 | 7 | import re |
8 | 8 | import warnings |
| 9 | import inspect |
9 | 10 | |
10 | 11 | from django.conf import settings |
11 | 12 | from django.core import mail |
… |
… |
class BrokenLinkEmailsMiddlewareTest(TestCase):
|
320 | 321 | BrokenLinkEmailsMiddleware().process_response(self.req, self.resp) |
321 | 322 | self.assertEqual(len(mail.outbox), 0) |
322 | 323 | |
| 324 | def test_is_ignorable_404_takes_user_agent(self): |
| 325 | assert 'user_agent' in \ |
| 326 | inspect.getargspec(BrokenLinkEmailsMiddleware.is_ignorable_404).args |
| 327 | broken_link_emails_middleware = BrokenLinkEmailsMiddleware() |
| 328 | broken_link_emails_middleware.is_ignorable_404( |
| 329 | 'irrelevant_url', user_agent='Some user agent' |
| 330 | ) |
| 331 | |
323 | 332 | |
324 | 333 | class ConditionalGetMiddlewareTest(TestCase): |
325 | 334 | urls = 'middleware.cond_get_urls' |