def gets_a_notification_only_once(self): handler = StubHandler() manager = NotificationManager(handler) manager.set('foo', 'bar') self.assertEqual(manager.get('foo'), 'bar') self.assertIsNone(manager.get('foo'))
def gets_a_notification_only_once(self): handler = StubHandler() manager = NotificationManager(handler) manager.set('foo', 'bar') self.assertEqual(manager.get('foo'), 'bar') self.assertIsNone(manager.get('foo'))
def gets_default_value_if_provided_and_not_in_client(self): handler = StubHandler() manager = NotificationManager(handler) value = manager.get('foo', 'Default') self.assertEqual(value, 'Default')
def gets_default_value_if_provided_and_not_in_client(self): handler = StubHandler() manager = NotificationManager(handler) value = manager.get('foo', 'Default') self.assertEqual(value, 'Default')
def removes_notification_from_database_after_retrieval(self): handler = StubHandler() manager = NotificationManager(handler) manager.set('foo', 'bar') raw_notifications = self.client.get(handler.session_id) notifications = pickle.loads(raw_notifications) self.assertEqual(list(notifications.keys()), ['foo']) manager.get('foo') raw_notifications = self.client.get(handler.session_id) notifications = pickle.loads(raw_notifications) self.assertEqual(list(notifications.keys()), [])
def removes_notification_from_database_after_retrieval(self): handler = StubHandler() manager = NotificationManager(handler) manager.set('foo', 'bar') raw_notifications = self.client.get(handler.session_id) notifications = pickle.loads(raw_notifications) self.assertEqual(list(notifications.keys()), ['foo']) manager.get('foo') raw_notifications = self.client.get(handler.session_id) notifications = pickle.loads(raw_notifications) self.assertEqual(list(notifications.keys()), [])