diff --git a/autopush/tests/test_endpoint.py b/autopush/tests/test_endpoint.py index 6c686dcd..c56573b2 100644 --- a/autopush/tests/test_endpoint.py +++ b/autopush/tests/test_endpoint.py @@ -570,31 +570,6 @@ def restore(*args, **kwargs): chid=str(dummy_chid)) return self.finish_deferred - def test_post_uaid_critical_failure(self, *args): - self.reg.request.body = json.dumps(dict( - type="webpush", - channelID=str(dummy_chid), - data={}, - )) - self.settings.router.get_uaid = Mock() - self.settings.router.get_uaid.return_value = { - "critical_failure": "Client is unreachable due to a configuration " - "error." - } - self.fernet_mock.configure_mock(**{ - 'encrypt.return_value': 'abcd123', - }) - - def handle_finish(value): - self._check_error(410, 105, "") - - self.finish_deferred.addCallback(handle_finish) - self.reg.request.headers["Authorization"] = self.auth - self._post(router_type="simplepush", - uaid=dummy_uaid.hex, - chid=str(dummy_chid)) - return self.finish_deferred - def test_post_nochid(self): self.reg.request.body = json.dumps(dict( type="simplepush", @@ -684,6 +659,10 @@ def handle_finish(value): app_id='', uri=self.reg.request.uri ) + user_data = self.router_mock.register_user.call_args[0][0] + eq_(user_data['uaid'], dummy_uaid.hex) + eq_(user_data['router_type'], 'test') + eq_(user_data['router_data']['token'], 'some_token') def restore(*args, **kwargs): uuid.uuid4 = old_func diff --git a/autopush/web/registration.py b/autopush/web/registration.py index ecd236f8..c5c4db1f 100644 --- a/autopush/web/registration.py +++ b/autopush/web/registration.py @@ -59,20 +59,10 @@ def extract_data(self, req): chid = req['path_kwargs'].get('chid', router_data.get("channelID")) if uaid: try: - u_uuid = uuid.UUID(uaid) + uuid.UUID(uaid) except (ValueError, TypeError): raise InvalidRequest("Invalid Request UAID", status_code=401, errno=109) - # Check if the UAID has a 'critical error' which means that it's - # probably invalid and should be reset/re-registered - try: - record = self.context['settings'].router.get_uaid(u_uuid.hex) - if record.get('critical_failure'): - raise InvalidRequest("Invalid Request UAID", - status_code=410, errno=105) - except ItemNotFound: - pass - if chid: try: uuid.UUID(chid)