示例#1
0
    def test_process_request_value_error(self, mock_timezone, mock_pytz):
        mock_pytz.side_effect = ValueError

        request = Mock(COOKIES={'utc_offset': 120})

        timezonemiddleware = TimezoneMiddleware()
        timezonemiddleware.process_request(request)
        self.assertTrue(mock_timezone.called)
示例#2
0
    def test_process_request_value_error(self, mock_timezone, mock_pytz):
        mock_pytz.side_effect = ValueError

        request = Mock(COOKIES={'utc_offset': 120})

        timezonemiddleware = TimezoneMiddleware()
        timezonemiddleware.process_request(request)
        self.assertTrue(mock_timezone.called)
示例#3
0
 def test_process_request_with_utc_offset(self, mock_timezone):
     mock_timezone.return_value = {}
     request = Mock(COOKIES={'utc_offset': 120})
     timezonemiddleware = TimezoneMiddleware()
     timezonemiddleware.process_request(request)
     self.assertTrue(mock_timezone.called)
示例#4
0
 def test_process_request_with_utc_offset(self, mock_timezone):
     mock_timezone.return_value = {}
     request = Mock(COOKIES={'utc_offset': 120})
     timezonemiddleware = TimezoneMiddleware()
     timezonemiddleware.process_request(request)
     self.assertTrue(mock_timezone.called)