コード例 #1
0
 def setUp(self):
     self.handler = NoIgnoreHandler()
     self.request = HttpRequest()
     self.request.META = {
         'CONTENT_LENGTH': '',
         'CONTENT_TYPE': 'text/html',
         'HTTP_ACCEPT_ENCODING': 'utf-8',
         'HTTP_ACCEPT_LANGUAGE': 'es',
         'HTTP_HOST': 'testhost',
         'HTTP_REFERER': 'testreferer',
         'HTTP_USER_AGENT': 'test user agent',
         'QUERY_STRING': '/',
         'REMOTE_ADDR': 'testaddress',
         'REMOTE_HOST': 'testhost',
         'REMOTE_USER': '******',
         'REQUEST_METHOD': 'GET',
         'SERVER_NAME': 'testserver',
         'SERVER_PORT': '80',
     }
コード例 #2
0
class NoIgnoreHandlerTest(unittest.TestCase):
    def setUp(self):
        self.handler = NoIgnoreHandler()
        self.request = HttpRequest()
        self.request.META = {
            'CONTENT_LENGTH': '',
            'CONTENT_TYPE': 'text/html',
            'HTTP_ACCEPT_ENCODING': 'utf-8',
            'HTTP_ACCEPT_LANGUAGE': 'es',
            'HTTP_HOST': 'testhost',
            'HTTP_REFERER': 'testreferer',
            'HTTP_USER_AGENT': 'test user agent',
            'QUERY_STRING': '/',
            'REMOTE_ADDR': 'testaddress',
            'REMOTE_HOST': 'testhost',
            'REMOTE_USER': '******',
            'REQUEST_METHOD': 'GET',
            'SERVER_NAME': 'testserver',
            'SERVER_PORT': '80',
        }

    def test_check(self):
        self.assertEqual(self.handler.check(self.request, data1=1, data2=2, data3=3), False)