Use http.HTTPStatus in components/[wxyz]* (#58330)
This commit is contained in:
parent
1a9bb47f78
commit
0de95610e3
16 changed files with 69 additions and 52 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue