Skip to content

Commit bdb80c9

Browse files
committed
(fix): fix the tests
1 parent 7a9eb3a commit bdb80c9

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

libdyson/cloud/account.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class DysonAccount:
5858
"""Dyson account."""
5959

6060
_HOST = DYSON_API_HOST
61-
_CERT = DYSON_CERT
6261

6362
def __init__(
6463
self,
@@ -180,7 +179,6 @@ class DysonAccountCN(DysonAccount):
180179
"""Dyson account in Mainland China."""
181180

182181
_HOST = DYSON_API_HOST_CN
183-
_CERT = DYSON_CERT_CN
184182

185183
def login_mobile_otp(self, mobile: str) -> Callable[[str], dict]:
186184
"""Login using phone number and OTP code."""

tests/cloud/mocked_requests.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import requests
77

8-
from libdyson.cloud.account import DYSON_API_HEADERS, DYSON_API_HOST, DYSON_CERT
8+
from libdyson.cloud.account import DYSON_API_HEADERS, DYSON_API_HOST
99

1010

1111
class MockedRequests:
@@ -14,7 +14,6 @@ class MockedRequests:
1414
def __init__(self):
1515
"""Initialize the mock."""
1616
self.host = DYSON_API_HOST
17-
self.cert = DYSON_CERT
1817
self._handlers = {}
1918

2019
@property
@@ -27,11 +26,10 @@ def register_handler(self, method: str, path: str, handler: Callable) -> None:
2726
self._handlers[(method, path)] = handler
2827

2928
def request(
30-
self, method: str, url: str, headers=None, verify=None, **kwargs
29+
self, method: str, url: str, headers=None, verify=True, **kwargs
3130
) -> requests.Response:
3231
"""Run mocked request function."""
3332
assert headers == DYSON_API_HEADERS
34-
assert verify == self.cert
3533
assert url.startswith(self.host)
3634
path = url[len(self.host) :]
3735
response = requests.Response()

tests/cloud/test_dyson_account.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
API_PATH_MOBILE_VERIFY,
1616
API_PATH_USER_STATUS,
1717
DYSON_API_HOST_CN,
18-
DYSON_CERT_CN,
1918
DysonAccountCN,
2019
HTTPBearerAuth,
2120
)
@@ -270,7 +269,6 @@ def _handle_email_request(
270269
def test_login_mobile(mocked_requests: MockedRequests):
271270
"""Test logging into account using phone number and otp code."""
272271
mocked_requests.host = DYSON_API_HOST_CN
273-
mocked_requests.cert = DYSON_CERT_CN
274272

275273
account = DysonAccountCN()
276274
verify = account.login_mobile_otp(MOBILE)
@@ -296,7 +294,6 @@ def _handle_mobile_request(
296294
return (429, None)
297295

298296
mocked_requests.host = DYSON_API_HOST_CN
299-
mocked_requests.cert = DYSON_CERT_CN
300297
mocked_requests.register_handler(
301298
"POST", API_PATH_MOBILE_REQUEST, _handle_mobile_request
302299
)
@@ -309,7 +306,6 @@ def _handle_mobile_request(
309306
def test_account_auth_info_bearer(mocked_requests: MockedRequests):
310307
"""Test initialize account with bearer auth info."""
311308
mocked_requests.host = DYSON_API_HOST_CN
312-
mocked_requests.cert = DYSON_CERT_CN
313309
account = DysonAccountCN(AUTH_INFO_BEARER)
314310
devices = account.devices()
315311
assert len(devices) == 2

0 commit comments

Comments
 (0)