Left: | ||
Right: |
OLD | NEW |
---|---|
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 load_notifications_call.return_value = [] | 294 load_notifications_call.return_value = [] |
295 notification.notification({"QUERY_STRING": "lastVersion="}, | 295 notification.notification({"QUERY_STRING": "lastVersion="}, |
296 lambda *args: None) | 296 lambda *args: None) |
297 notification.notification({"QUERY_STRING": "lastVersion=-"}, | 297 notification.notification({"QUERY_STRING": "lastVersion=-"}, |
298 lambda *args: None) | 298 lambda *args: None) |
299 notification.notification({"QUERY_STRING": "lastVersion=-/"}, | 299 notification.notification({"QUERY_STRING": "lastVersion=-/"}, |
300 lambda *args: None) | 300 lambda *args: None) |
301 notification.notification({"QUERY_STRING": "lastVersion=-//"}, | 301 notification.notification({"QUERY_STRING": "lastVersion=-//"}, |
302 lambda *args: None) | 302 lambda *args: None) |
303 | 303 |
304 @mock.patch("sitescripts.notifications.web.notification.load_notifications") | |
305 def test_version_header_present(self, load_notifications_call): | |
306 load_notifications_call.return_value = [{"id": "1"}] | |
307 response_header_map = {} | |
308 def start_response(status, response_headers): | |
309 for name, value in response_headers: | |
Sebastian Noack
2015/06/02 22:35:47
Not much simpler, but here you go:
response_hea
Felix Dahlke
2015/06/03 03:21:07
I've tried this before - unfortunately it doesn't
| |
310 response_header_map[name] = value | |
311 result = json.loads(notification.notification({}, start_response)) | |
312 self.assertEqual(result["version"], | |
313 response_header_map["ABP-Notification-Version"]) | |
314 | |
304 if __name__ == '__main__': | 315 if __name__ == '__main__': |
305 unittest.main() | 316 unittest.main() |
OLD | NEW |