Use http.HTTPStatus in components/[wxyz]* (#58330)

This commit is contained in:
Ville Skyttä 2021-10-24 18:25:01 +03:00 committed by GitHub
parent 1a9bb47f78
commit 0de95610e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 69 additions and 52 deletions

View file

@ -1,4 +1,5 @@
"""The tests for the Xiaomi router device tracker platform."""
from http import HTTPStatus
import logging
from unittest.mock import MagicMock, call, patch
@ -40,8 +41,8 @@ def mocked_requests(*args, **kwargs):
return self.json()
def raise_for_status(self):
"""Raise an HTTPError if status is not 200."""
if self.status_code != 200:
"""Raise an HTTPError if status is not OK."""
if self.status_code != HTTPStatus.OK:
raise requests.HTTPError(self.status_code)
data = kwargs.get("data")