Skip to content

Commit

Permalink
use parens
Browse files Browse the repository at this point in the history
  • Loading branch information
matin committed Jun 30, 2024
1 parent ea47b50 commit 05e72c1
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions tests/data/test_hrv_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_hrv_data_get(authed_client: Client):
hrv_data = HRVData.get("2023-07-20", client=authed_client)
assert hrv_data
Expand All @@ -16,7 +16,7 @@ def test_hrv_data_get(authed_client: Client):
assert HRVData.get("2021-07-20", client=authed_client) is None


@pytest.mark.vcr
@pytest.mark.vcr()
def test_hrv_data_list(authed_client: Client):
days = 2
end = date(2023, 7, 20)
Expand Down
4 changes: 2 additions & 2 deletions tests/data/test_sleep_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_sleep_data_get(authed_client: Client):
sleep_data = SleepData.get("2021-07-20", client=authed_client)
assert sleep_data
Expand All @@ -15,7 +15,7 @@ def test_sleep_data_get(authed_client: Client):
assert sleep_data.daily_sleep_dto.sleep_end


@pytest.mark.vcr
@pytest.mark.vcr()
def test_sleep_data_list(authed_client: Client):
end = date(2021, 7, 20)
days = 20
Expand Down
8 changes: 4 additions & 4 deletions tests/stats/test_hrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_hrv(authed_client: Client):
end = date(2023, 7, 20)
days = 20
Expand All @@ -15,7 +15,7 @@ def test_daily_hrv(authed_client: Client):
assert len(daily_hrv) == days


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_hrv_paginate(authed_client: Client):
end = date(2023, 7, 20)
days = 40
Expand All @@ -24,14 +24,14 @@ def test_daily_hrv_paginate(authed_client: Client):
assert len(daily_hrv) == days


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_hrv_no_results(authed_client: Client):
end = date(1990, 7, 20)
daily_hrv = DailyHRV.list(end, client=authed_client)
assert daily_hrv == []


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_hrv_paginate_no_results(authed_client: Client):
end = date(1990, 7, 20)
days = 40
Expand Down
2 changes: 1 addition & 1 deletion tests/stats/test_hydration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_hydration(authed_client: Client):
end = date(2024, 6, 29)
daily_hydration = DailyHydration.list(end, client=authed_client)
Expand Down
4 changes: 2 additions & 2 deletions tests/stats/test_intensity_minutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_intensity_minutes(authed_client: Client):
end = date(2023, 7, 20)
days = 20
Expand All @@ -15,7 +15,7 @@ def test_daily_intensity_minutes(authed_client: Client):
assert len(daily_im) == days


@pytest.mark.vcr
@pytest.mark.vcr()
def test_weekly_intensity_minutes(authed_client: Client):
end = date(2023, 7, 20)
weeks = 12
Expand Down
2 changes: 1 addition & 1 deletion tests/stats/test_sleep_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_sleep(authed_client: Client):
end = date(2023, 7, 20)
days = 20
Expand Down
4 changes: 2 additions & 2 deletions tests/stats/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_steps(authed_client: Client):
end = date(2023, 7, 20)
days = 20
Expand All @@ -15,7 +15,7 @@ def test_daily_steps(authed_client: Client):
assert len(daily_steps) == days


@pytest.mark.vcr
@pytest.mark.vcr()
def test_weekly_steps(authed_client: Client):
end = date(2023, 7, 20)
weeks = 52
Expand Down
10 changes: 5 additions & 5 deletions tests/stats/test_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_stress(authed_client: Client):
end = date(2023, 7, 20)
days = 20
Expand All @@ -15,15 +15,15 @@ def test_daily_stress(authed_client: Client):
assert len(daily_stress) == days


@pytest.mark.vcr
@pytest.mark.vcr()
def test_daily_stress_pagination(authed_client: Client):
end = date(2023, 7, 20)
days = 60
daily_stress = DailyStress.list(end, days, client=authed_client)
assert len(daily_stress) == days


@pytest.mark.vcr
@pytest.mark.vcr()
def test_weekly_stress(authed_client: Client):
end = date(2023, 7, 20)
weeks = 52
Expand All @@ -32,7 +32,7 @@ def test_weekly_stress(authed_client: Client):
assert weekly_stress[-1].calendar_date == end - timedelta(days=6)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_weekly_stress_pagination(authed_client: Client):
end = date(2023, 7, 20)
weeks = 60
Expand All @@ -41,7 +41,7 @@ def test_weekly_stress_pagination(authed_client: Client):
assert weekly_stress[-1].calendar_date == end - timedelta(days=6)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_weekly_stress_beyond_data(authed_client: Client):
end = date(2023, 7, 20)
weeks = 1000
Expand Down
18 changes: 9 additions & 9 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_pool_connections(client: Client):
assert adapter._pool_maxsize == 99


@pytest.mark.vcr
@pytest.mark.vcr()
def test_client_request(client: Client):
resp = client.request("GET", "connect", "/")
assert resp.ok
Expand All @@ -112,7 +112,7 @@ def test_client_request(client: Client):
assert "404" in str(e.value)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_login_success_mfa(monkeypatch, client: Client):
def mock_input(_):
return "327751"
Expand All @@ -126,14 +126,14 @@ def mock_input(_):
assert client.oauth2_token


@pytest.mark.vcr
@pytest.mark.vcr()
def test_username(authed_client: Client):
assert authed_client._profile is None
assert authed_client.username
assert authed_client._profile


@pytest.mark.vcr
@pytest.mark.vcr()
def test_connectapi(authed_client: Client):
stress = authed_client.connectapi(
"/usersummary-service/stats/stress/daily/2023-07-21/2023-07-21"
Expand All @@ -151,7 +151,7 @@ def test_connectapi(authed_client: Client):
]


@pytest.mark.vcr
@pytest.mark.vcr()
def test_refresh_oauth2_token(authed_client: Client):
assert authed_client.oauth2_token
authed_client.oauth2_token.expires_at = int(time.time())
Expand All @@ -162,7 +162,7 @@ def test_refresh_oauth2_token(authed_client: Client):
assert profile["userName"]


@pytest.mark.vcr
@pytest.mark.vcr()
def test_download(authed_client: Client):
downloaded = authed_client.download(
"/download-service/files/activity/11998957007"
Expand All @@ -172,15 +172,15 @@ def test_download(authed_client: Client):
assert downloaded[:4] == zip_magic_number


@pytest.mark.vcr
@pytest.mark.vcr()
def test_upload(authed_client: Client):
fpath = "tests/12129115726_ACTIVITY.fit"
with open(fpath, "rb") as f:
uploaded = authed_client.upload(f)
assert uploaded


@pytest.mark.vcr
@pytest.mark.vcr()
def test_delete(authed_client: Client):
activity_id = "12135235656"
path = f"/activity-service/activity/{activity_id}"
Expand All @@ -195,7 +195,7 @@ def test_delete(authed_client: Client):
assert "404" in str(e.value)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_put(authed_client: Client):
data = [
{
Expand Down
10 changes: 5 additions & 5 deletions tests/test_sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_login_email_password_fail(client: Client):
with pytest.raises(GarthHTTPError):
sso.login("[email protected]", "wrong_p@ssword", client=client)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_login_success(client: Client):
oauth1, oauth2 = sso.login(
"[email protected]", "correct_password", client=client
Expand All @@ -26,7 +26,7 @@ def test_login_success(client: Client):
assert isinstance(oauth2, OAuth2Token)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_login_success_mfa(monkeypatch, client: Client):
def mock_input(_):
return "671091"
Expand All @@ -42,7 +42,7 @@ def mock_input(_):
assert isinstance(oauth2, OAuth2Token)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_login_success_mfa_async(monkeypatch, client: Client):
def mock_input(_):
return "031174"
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_set_expirations(oauth2_token_dict: dict):
)


@pytest.mark.vcr
@pytest.mark.vcr()
def test_exchange(authed_client: Client):
assert authed_client.oauth1_token
oauth1_token = authed_client.oauth1_token
Expand Down
4 changes: 2 additions & 2 deletions tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from garth.http import Client


@pytest.mark.vcr
@pytest.mark.vcr()
def test_user_profile(authed_client: Client):
profile = UserProfile.get(client=authed_client)
assert profile.user_name


@pytest.mark.vcr
@pytest.mark.vcr()
def test_user_setttings(authed_client: Client):
settings = UserSettings.get(client=authed_client)
assert settings.user_data

0 comments on commit 05e72c1

Please sign in to comment.