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)
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)