diff --git a/autopush/tests/test_websocket.py b/autopush/tests/test_websocket.py index 6fbac597..a4a1b286 100644 --- a/autopush/tests/test_websocket.py +++ b/autopush/tests/test_websocket.py @@ -1258,6 +1258,14 @@ def test_ack_remove_not_set(self): self.proto.ps.updates_sent[chid] = None self.proto._handle_webpush_update_remove(None, chid, notif) + def test_ack_remove_missing(self): + self._connect() + chid = str(uuid.uuid4()) + notif = Notification(version="bleh", headers={}, data="meh", + channel_id=chid, ttl=200, timestamp=0) + self.proto.ps.updates_sent[chid] = [] + self.proto._handle_webpush_update_remove(None, chid, notif) + def test_ack_fails_first_time(self): self._connect() self.proto.ps.uaid = str(uuid.uuid4()) diff --git a/autopush/websocket.py b/autopush/websocket.py index 56768fb8..00fde0b1 100644 --- a/autopush/websocket.py +++ b/autopush/websocket.py @@ -1148,7 +1148,7 @@ def _handle_webpush_update_remove(self, result, chid, notif): """ try: self.ps.updates_sent[chid].remove(notif) - except AttributeError: + except (AttributeError, ValueError): pass def _handle_simple_ack(self, chid, version, code):