Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/notifications/test/notification.py

Issue 6402627529080832: Issue 2610 - Return notification version in a response header (Closed)
Patch Set: Created May 30, 2015, 8:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sitescripts/notifications/web/notification.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/notifications/test/notification.py
===================================================================
--- a/sitescripts/notifications/test/notification.py
+++ b/sitescripts/notifications/test/notification.py
@@ -301,5 +301,16 @@
notification.notification({"QUERY_STRING": "lastVersion=-//"},
lambda *args: None)
+ @mock.patch("sitescripts.notifications.web.notification.load_notifications")
+ def test_version_header_present(self, load_notifications_call):
+ load_notifications_call.return_value = [{"id": "1"}]
+ response_header_map = {}
+ def start_response(status, response_headers):
+ 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
+ response_header_map[name] = value
+ result = json.loads(notification.notification({}, start_response))
+ self.assertEqual(result["version"],
+ response_header_map["ABP-Notification-Version"])
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « no previous file | sitescripts/notifications/web/notification.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld