Files
plexpy/tests/test_statistics.py

129 lines
4.1 KiB
Python

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from plex_api_client import PlexAPI
from plex_api_client.models import operations
def test_statistics_get_statistics_():
s = PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
)
assert s is not None
res = s.statistics.get_statistics(timespan=4)
assert res.status_code == 200
assert res.object is not None
assert res.object == operations.GetStatisticsResponseBody(
media_container=operations.GetStatisticsMediaContainer(
size=5497,
device=[
operations.GetStatisticsDevice(
id=208,
name="Roku Express",
platform="Roku",
client_identifier="793095d235660625108ef785cc7646e9",
created_at=1706470556,
),
],
account=[
operations.Account(
id=238960586,
key="/accounts/238960586",
name="Diane",
default_audio_language="en",
auto_select_audio=True,
default_subtitle_language="en",
subtitle_mode=1,
thumb="https://plex.tv/users/50d83634246da1de/avatar?c=1707110967",
),
],
statistics_media=[
operations.StatisticsMedia(
account_id=1,
device_id=13,
timespan=4,
at=1707141600,
metadata_type=4,
count=1,
duration=1555,
),
],
),
)
def test_statistics_get_resources_statistics_():
s = PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
)
assert s is not None
res = s.statistics.get_resources_statistics(timespan=4)
assert res.status_code == 200
assert res.object is not None
assert res.object == operations.GetResourcesStatisticsResponseBody(
media_container=operations.GetResourcesStatisticsMediaContainer(
size=5497,
statistics_resources=[
operations.StatisticsResources(
timespan=6,
at=1718384427,
host_cpu_utilization=1.276,
process_cpu_utilization=0.025,
host_memory_utilization=17.026,
process_memory_utilization=0.493,
),
],
),
)
def test_statistics_get_bandwidth_statistics_():
s = PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
)
assert s is not None
res = s.statistics.get_bandwidth_statistics(timespan=4)
assert res.status_code == 200
assert res.object is not None
assert res.object == operations.GetBandwidthStatisticsResponseBody(
media_container=operations.GetBandwidthStatisticsMediaContainer(
size=5497,
device=[
operations.GetBandwidthStatisticsDevice(
id=208,
name="Roku Express",
platform="Roku",
client_identifier="793095d235660625108ef785cc7646e9",
created_at=1706470556,
),
],
account=[
operations.GetBandwidthStatisticsAccount(
id=238960586,
key="/accounts/238960586",
name="Diane",
default_audio_language="en",
auto_select_audio=True,
default_subtitle_language="en",
subtitle_mode=1,
thumb="https://plex.tv/users/50d83634246da1de/avatar?c=1707110967",
),
],
statistics_bandwidth=[
operations.StatisticsBandwidth(
account_id=238960586,
device_id=208,
timespan=6,
at=1718387650,
lan=True,
bytes=22,
),
],
),
)