mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-10 04:21:03 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.404.5
This commit is contained in:
382
tests/test_authentication.py
Normal file
382
tests/test_authentication.py
Normal file
@@ -0,0 +1,382 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
import dateutil.parser
|
||||
from plex_api_client import PlexAPI
|
||||
from plex_api_client.models import operations
|
||||
|
||||
|
||||
def test_authentication_get_transient_token():
|
||||
s = PlexAPI(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
)
|
||||
|
||||
assert s is not None
|
||||
|
||||
res = s.authentication.get_transient_token(
|
||||
type_=operations.GetTransientTokenQueryParamType.DELEGATION,
|
||||
scope=operations.Scope.ALL,
|
||||
)
|
||||
assert res.status_code == 200
|
||||
|
||||
|
||||
def test_authentication_get_source_connection_information():
|
||||
s = PlexAPI(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
)
|
||||
|
||||
assert s is not None
|
||||
|
||||
res = s.authentication.get_source_connection_information(
|
||||
source="provider://provider-identifier"
|
||||
)
|
||||
assert res.status_code == 200
|
||||
|
||||
|
||||
def test_authentication_get_token_details():
|
||||
s = PlexAPI(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
)
|
||||
|
||||
assert s is not None
|
||||
|
||||
res = s.authentication.get_token_details()
|
||||
assert res.status_code == 200
|
||||
assert res.user_plex_account is not None
|
||||
assert res.user_plex_account == operations.GetTokenDetailsUserPlexAccount(
|
||||
ads_consent=True,
|
||||
ads_consent_reminder_at=dateutil.parser.isoparse("2019-08-24T14:15:22Z"),
|
||||
ads_consent_set_at=dateutil.parser.isoparse("2019-08-24T14:15:22Z"),
|
||||
anonymous=False,
|
||||
auth_token="CxoUzBTSV5hsxjTpFKaf",
|
||||
backup_codes_created=False,
|
||||
confirmed=False,
|
||||
country="US",
|
||||
email="username@email.com",
|
||||
email_only_auth=False,
|
||||
experimental_features=False,
|
||||
friendly_name="friendlyUsername",
|
||||
entitlements=[
|
||||
"[]",
|
||||
],
|
||||
guest=False,
|
||||
has_password=True,
|
||||
home=False,
|
||||
home_admin=False,
|
||||
home_size=1,
|
||||
id=13692262,
|
||||
joined_at=1556281940,
|
||||
locale=None,
|
||||
mailing_list_active=False,
|
||||
mailing_list_status=operations.MailingListStatus.ACTIVE,
|
||||
max_home_size=15,
|
||||
pin="string",
|
||||
profile=operations.UserProfile(
|
||||
auto_select_audio=True,
|
||||
default_audio_language="ja",
|
||||
default_subtitle_language="en",
|
||||
auto_select_subtitle=operations.AutoSelectSubtitle.ENABLE,
|
||||
default_subtitle_accessibility=operations.DefaultSubtitleAccessibility.ENABLE,
|
||||
default_subtitle_forced=operations.DefaultSubtitleForced.ENABLE,
|
||||
watched_indicator=operations.WatchedIndicator.ENABLE,
|
||||
media_reviews_visibility=operations.MediaReviewsVisibility.ENABLE,
|
||||
),
|
||||
protected=False,
|
||||
remember_expires_at=1556281940,
|
||||
restricted=False,
|
||||
roles=[
|
||||
"string",
|
||||
],
|
||||
scrobble_types="",
|
||||
services=[
|
||||
operations.Services(
|
||||
identifier="metadata-dev",
|
||||
endpoint="https://epg.provider.plex.tv",
|
||||
token="DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
|
||||
secret="string",
|
||||
status=operations.GetTokenDetailsStatus.ONLINE,
|
||||
),
|
||||
],
|
||||
subscription=operations.Subscription(
|
||||
features=[
|
||||
operations.Features.ANDROID_DOLBY_VISION,
|
||||
],
|
||||
active=True,
|
||||
subscribed_at="2021-04-12T18:21:12Z",
|
||||
status=operations.GetTokenDetailsAuthenticationStatus.INACTIVE,
|
||||
payment_service="string",
|
||||
plan="string",
|
||||
),
|
||||
subscription_description="string",
|
||||
subscriptions=[
|
||||
operations.GetTokenDetailsSubscription(
|
||||
features=[
|
||||
operations.GetTokenDetailsFeatures.ANDROID_DOLBY_VISION,
|
||||
],
|
||||
active=True,
|
||||
subscribed_at="2021-04-12T18:21:12Z",
|
||||
status=operations.GetTokenDetailsAuthenticationResponseStatus.INACTIVE,
|
||||
payment_service="string",
|
||||
plan="string",
|
||||
),
|
||||
],
|
||||
thumb="https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
|
||||
title="UsernameTitle",
|
||||
two_factor_enabled=False,
|
||||
username="Username",
|
||||
uuid="dae343c1f45beb4f",
|
||||
attribution_partner=None,
|
||||
)
|
||||
|
||||
|
||||
def test_authentication_post_users_sign_in_data():
|
||||
s = PlexAPI()
|
||||
|
||||
assert s is not None
|
||||
|
||||
res = s.authentication.post_users_sign_in_data(
|
||||
request={
|
||||
"request_body": {
|
||||
"login": "username@email.com",
|
||||
"password": "password123",
|
||||
"verification_code": "123456",
|
||||
},
|
||||
}
|
||||
)
|
||||
assert res.status_code == 201
|
||||
assert res.user_plex_account is not None
|
||||
assert res.user_plex_account == operations.PostUsersSignInDataUserPlexAccount(
|
||||
ads_consent=True,
|
||||
ads_consent_reminder_at=dateutil.parser.isoparse("2019-08-24T14:15:22Z"),
|
||||
ads_consent_set_at=dateutil.parser.isoparse("2019-08-24T14:15:22Z"),
|
||||
anonymous=False,
|
||||
auth_token="CxoUzBTSV5hsxjTpFKaf",
|
||||
backup_codes_created=False,
|
||||
confirmed=False,
|
||||
country="US",
|
||||
email="username@email.com",
|
||||
email_only_auth=False,
|
||||
experimental_features=False,
|
||||
friendly_name="friendlyUsername",
|
||||
entitlements=[
|
||||
"[]",
|
||||
],
|
||||
guest=False,
|
||||
has_password=True,
|
||||
home=False,
|
||||
home_admin=False,
|
||||
home_size=1,
|
||||
id=13692262,
|
||||
joined_at=1556281940,
|
||||
locale=None,
|
||||
mailing_list_active=False,
|
||||
mailing_list_status=operations.PostUsersSignInDataMailingListStatus.UNSUBSCRIBED,
|
||||
max_home_size=15,
|
||||
pin="string",
|
||||
profile=operations.PostUsersSignInDataUserProfile(
|
||||
auto_select_audio=True,
|
||||
default_audio_language="ja",
|
||||
default_subtitle_language="en",
|
||||
auto_select_subtitle=operations.PostUsersSignInDataAutoSelectSubtitle.ENABLE,
|
||||
default_subtitle_accessibility=operations.PostUsersSignInDataDefaultSubtitleAccessibility.ENABLE,
|
||||
default_subtitle_forced=operations.PostUsersSignInDataDefaultSubtitleForced.ENABLE,
|
||||
watched_indicator=operations.PostUsersSignInDataWatchedIndicator.ENABLE,
|
||||
media_reviews_visibility=operations.PostUsersSignInDataMediaReviewsVisibility.ENABLE,
|
||||
),
|
||||
protected=False,
|
||||
remember_expires_at=1556281940,
|
||||
restricted=False,
|
||||
roles=[
|
||||
"string",
|
||||
],
|
||||
scrobble_types="",
|
||||
services=[
|
||||
operations.PostUsersSignInDataServices(
|
||||
identifier="metadata-dev",
|
||||
endpoint="https://epg.provider.plex.tv",
|
||||
token="DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
|
||||
secret="string",
|
||||
status=operations.PostUsersSignInDataStatus.ONLINE,
|
||||
),
|
||||
],
|
||||
subscription=operations.PostUsersSignInDataSubscription(
|
||||
features=[
|
||||
operations.PostUsersSignInDataFeatures.ANDROID_DOLBY_VISION,
|
||||
],
|
||||
active=True,
|
||||
subscribed_at="2021-04-12T18:21:12Z",
|
||||
status=operations.PostUsersSignInDataAuthenticationStatus.INACTIVE,
|
||||
payment_service="string",
|
||||
plan="string",
|
||||
),
|
||||
subscription_description="string",
|
||||
subscriptions=[
|
||||
operations.PostUsersSignInDataAuthenticationSubscription(
|
||||
features=[
|
||||
operations.PostUsersSignInDataAuthenticationFeatures.ANDROID_DOLBY_VISION,
|
||||
],
|
||||
active=True,
|
||||
subscribed_at="2021-04-12T18:21:12Z",
|
||||
status=operations.PostUsersSignInDataAuthenticationResponseStatus.INACTIVE,
|
||||
payment_service="string",
|
||||
plan="string",
|
||||
),
|
||||
],
|
||||
thumb="https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
|
||||
title="UsernameTitle",
|
||||
two_factor_enabled=False,
|
||||
username="Username",
|
||||
uuid="dae343c1f45beb4f",
|
||||
attribution_partner=None,
|
||||
past_subscriptions=[
|
||||
operations.PastSubscription(
|
||||
id="string",
|
||||
mode="string",
|
||||
renews_at=1556281940,
|
||||
ends_at=1556281940,
|
||||
canceled=False,
|
||||
grace_period=False,
|
||||
on_hold=False,
|
||||
can_reactivate=False,
|
||||
can_upgrade=False,
|
||||
can_downgrade=False,
|
||||
can_convert=False,
|
||||
type="plexpass",
|
||||
transfer="string",
|
||||
state=operations.PostUsersSignInDataState.ENDED,
|
||||
billing=operations.Billing(
|
||||
internal_payment_method=operations.InternalPaymentMethod(),
|
||||
payment_method_id=481656,
|
||||
),
|
||||
),
|
||||
],
|
||||
trials=[
|
||||
operations.Trials(),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def test_authentication_post_users_sign_in_data_():
|
||||
s = PlexAPI()
|
||||
|
||||
assert s is not None
|
||||
|
||||
res = s.authentication.post_users_sign_in_data(
|
||||
request={
|
||||
"request_body": {
|
||||
"login": "username@email.com",
|
||||
"password": "password123",
|
||||
"verification_code": "123456",
|
||||
},
|
||||
}
|
||||
)
|
||||
assert res.status_code == 201
|
||||
assert res.user_plex_account is not None
|
||||
assert res.user_plex_account == operations.PostUsersSignInDataUserPlexAccount(
|
||||
ads_consent=True,
|
||||
ads_consent_reminder_at=dateutil.parser.isoparse("2019-08-24T14:15:22Z"),
|
||||
ads_consent_set_at=dateutil.parser.isoparse("2019-08-24T14:15:22Z"),
|
||||
anonymous=False,
|
||||
auth_token="CxoUzBTSV5hsxjTpFKaf",
|
||||
backup_codes_created=False,
|
||||
confirmed=False,
|
||||
country="US",
|
||||
email="username@email.com",
|
||||
email_only_auth=False,
|
||||
experimental_features=False,
|
||||
friendly_name="friendlyUsername",
|
||||
entitlements=[
|
||||
"[]",
|
||||
],
|
||||
guest=False,
|
||||
has_password=True,
|
||||
home=False,
|
||||
home_admin=False,
|
||||
home_size=1,
|
||||
id=13692262,
|
||||
joined_at=1721154902,
|
||||
locale=None,
|
||||
mailing_list_active=False,
|
||||
mailing_list_status=operations.PostUsersSignInDataMailingListStatus.UNSUBSCRIBED,
|
||||
max_home_size=15,
|
||||
pin="string",
|
||||
profile=operations.PostUsersSignInDataUserProfile(
|
||||
auto_select_audio=True,
|
||||
default_audio_language="ja",
|
||||
default_subtitle_language="en",
|
||||
auto_select_subtitle=operations.PostUsersSignInDataAutoSelectSubtitle.ENABLE,
|
||||
default_subtitle_accessibility=operations.PostUsersSignInDataDefaultSubtitleAccessibility.ENABLE,
|
||||
default_subtitle_forced=operations.PostUsersSignInDataDefaultSubtitleForced.ENABLE,
|
||||
watched_indicator=operations.PostUsersSignInDataWatchedIndicator.ENABLE,
|
||||
media_reviews_visibility=operations.PostUsersSignInDataMediaReviewsVisibility.ENABLE,
|
||||
),
|
||||
protected=False,
|
||||
remember_expires_at=1722364046,
|
||||
restricted=False,
|
||||
roles=[
|
||||
"string",
|
||||
],
|
||||
scrobble_types="",
|
||||
services=[
|
||||
operations.PostUsersSignInDataServices(
|
||||
identifier="metadata-dev",
|
||||
endpoint="https://epg.provider.plex.tv",
|
||||
token="DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
|
||||
secret="string",
|
||||
status=operations.PostUsersSignInDataStatus.ONLINE,
|
||||
),
|
||||
],
|
||||
subscription=operations.PostUsersSignInDataSubscription(
|
||||
features=[
|
||||
operations.PostUsersSignInDataFeatures.ANDROID_DOLBY_VISION,
|
||||
],
|
||||
active=True,
|
||||
subscribed_at="2021-04-12T18:21:12Z",
|
||||
status=operations.PostUsersSignInDataAuthenticationStatus.INACTIVE,
|
||||
payment_service="string",
|
||||
plan="string",
|
||||
),
|
||||
subscription_description="string",
|
||||
subscriptions=[
|
||||
operations.PostUsersSignInDataAuthenticationSubscription(
|
||||
features=[
|
||||
operations.PostUsersSignInDataAuthenticationFeatures.ANDROID_DOLBY_VISION,
|
||||
],
|
||||
active=True,
|
||||
subscribed_at="2021-04-12T18:21:12Z",
|
||||
status=operations.PostUsersSignInDataAuthenticationResponseStatus.INACTIVE,
|
||||
payment_service="string",
|
||||
plan="string",
|
||||
),
|
||||
],
|
||||
thumb="https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
|
||||
title="UsernameTitle",
|
||||
two_factor_enabled=False,
|
||||
username="Username",
|
||||
uuid="dae343c1f45beb4f",
|
||||
attribution_partner=None,
|
||||
past_subscriptions=[
|
||||
operations.PastSubscription(
|
||||
id="string",
|
||||
mode="string",
|
||||
renews_at=string,
|
||||
ends_at=1556281940,
|
||||
canceled=True,
|
||||
grace_period=True,
|
||||
on_hold=True,
|
||||
can_reactivate=True,
|
||||
can_upgrade=True,
|
||||
can_downgrade=True,
|
||||
can_convert=True,
|
||||
type="plexpass",
|
||||
transfer="string",
|
||||
state=operations.PostUsersSignInDataState.ENDED,
|
||||
billing=operations.Billing(
|
||||
internal_payment_method=operations.InternalPaymentMethod(),
|
||||
payment_method_id=481656,
|
||||
),
|
||||
),
|
||||
],
|
||||
trials=[
|
||||
operations.Trials(),
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user