diff --git a/webapp/shop/api/ua_contracts/api.py b/webapp/shop/api/ua_contracts/api.py index a4f18a2ce5b..5955e2fb228 100644 --- a/webapp/shop/api/ua_contracts/api.py +++ b/webapp/shop/api/ua_contracts/api.py @@ -44,12 +44,16 @@ def _request( error_rules=None, headers={}, ): - headers["Authorization"] = f"{self.token_type} {self.authentication_token}" + headers[ + "Authorization" + ] = f"{self.token_type} {self.authentication_token}" if self.remote_addr: headers["X-Forwarded-For"] = self.remote_addr logger = logging.getLogger("talisker.requests") - logger.info("remote address", extra={"remote_addr": self.remote_addr}) + logger.info( + "remote address", extra={"remote_addr": self.remote_addr} + ) response = self.session.request( method=method, @@ -163,7 +167,9 @@ def put_customer_info( error_rules=["default"], ).json() - def put_anonymous_customer_info(self, account_id, name, address, tax_id) -> dict: + def put_anonymous_customer_info( + self, account_id, name, address, tax_id + ) -> dict: return self._request( method="put", path=f"v1/accounts/{account_id}/customer-info/stripe", @@ -206,7 +212,9 @@ def accept_renewal(self, renewal_id) -> dict: return {} - def get_product_listings(self, marketplace: str, filters: str = "") -> dict: + def get_product_listings( + self, marketplace: str, filters: str = "" + ) -> dict: return self._request( method="get", path=f"v1/marketplace/{marketplace}/product-listings{filters}", @@ -226,7 +234,9 @@ def get_account_subscriptions( error_rules=["default", "auth"], ).json() - def get_account_purchases(self, account_id: str, filters: str = "") -> dict: + def get_account_purchases( + self, account_id: str, filters: str = "" + ) -> dict: return self._request( method="get", path=f"v1/accounts/{account_id}/purchases{filters}", diff --git a/webapp/shop/cred/mock_logout.py b/webapp/shop/cred/mock_logout.py index a1f620d7663..44b5fdc8c75 100644 --- a/webapp/shop/cred/mock_logout.py +++ b/webapp/shop/cred/mock_logout.py @@ -7,9 +7,8 @@ def get_mock_cue_annotated_contract_items(email): if email == "test@fail.com": res._content = b'{"code": "unauthorized","message": "unauthorized","traceId": "4f741380-317d-409d-a2e2-ed3e89565f56"}' res.status_code = 401 - - else: + else: mock_exams = [ { "accountContext": { @@ -62,6 +61,6 @@ def get_mock_cue_annotated_contract_items(email): ] res._content = json.dumps(mock_exams).encode("utf-8") res.status_code = 200 - + res.raise_for_status() return res.json() diff --git a/webapp/shop/cred/views.py b/webapp/shop/cred/views.py index a4090456dea..bf17ab684fb 100644 --- a/webapp/shop/cred/views.py +++ b/webapp/shop/cred/views.py @@ -403,9 +403,7 @@ def cred_your_exams(ua_contracts_api, trueability_api, **kwargs): # exam_contracts = ua_contracts_api.get_annotated_contract_items( # email=email, product_tags=["cue"] # ) - exam_contracts = get_mock_cue_annotated_contract_items( - email=email - ) + exam_contracts = get_mock_cue_annotated_contract_items(email=email) except Exception as error: print(error) flask.current_app.extensions["sentry"].captureException( @@ -422,7 +420,6 @@ def cred_your_exams(ua_contracts_api, trueability_api, **kwargs): else: exam_contracts = [] - exams_in_progress = [] exams_scheduled = [] exams_not_taken = []