-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3194635
commit cfce126
Showing
6 changed files
with
117 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
import asyncio | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def event_loop(): | ||
try: | ||
loop = asyncio.get_running_loop() | ||
except RuntimeError: | ||
loop = asyncio.new_event_loop() | ||
yield loop | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import asyncio | ||
import pytest | ||
from ..xvideos_api import Client | ||
|
||
client = Client() | ||
@pytest.mark.asyncio | ||
async def test_download(): | ||
client = Client() | ||
|
||
url_1 = "https://de.xvideos.com/video.ufavdcma5da/regional/202/0/gilf_showing_her_new_sexy_new_years_eve_party_outfit_with_some_dirtytalk._watch_the_horny_granny_nude_at_the_end_ai-generated" | ||
url_2 = "https://de.xvideos.com/video.ufceveh7bfc/regional/202/0/called_a_whore_on_new_year_s_eve_-_stepsister_came_-_had_to_fuck_her_-_russian_amateur_with_conversations_and_subtitles" | ||
url_3 = "https://de.xvideos.com/video.ufdidkbdca0/regional/202/0/hot_milf_gives_handjob_from_behind_-_step_mom_helping_step_son_handmade._new_year_party" | ||
url_1 = "https://de.xvideos.com/video.ufavdcma5da/regional/202/0/gilf_showing_her_new_sexy_new_years_eve_party_outfit_with_some_dirtytalk._watch_the_horny_granny_nude_at_the_end_ai-generated" | ||
url_2 = "https://de.xvideos.com/video.ufceveh7bfc/regional/202/0/called_a_whore_on_new_year_s_eve_-_stepsister_came_-_had_to_fuck_her_-_russian_amateur_with_conversations_and_subtitles" | ||
url_3 = "https://de.xvideos.com/video.ufdidkbdca0/regional/202/0/hot_milf_gives_handjob_from_behind_-_step_mom_helping_step_son_handmade._new_year_party" | ||
|
||
video_1 = client.get_video(url_1) | ||
video_2 = client.get_video(url_2) | ||
video_3 = client.get_video(url_3) | ||
|
||
def test_download_high(): | ||
assert video_1.download(downloader="threaded", quality="best") is True | ||
|
||
def test_download_half(): | ||
assert video_2.download(downloader="threaded", quality="half") is True | ||
|
||
def test_download_worst(): | ||
assert video_3.download(downloader="threaded", quality="worst") is True | ||
video_1 = await client.get_video(url_1) | ||
video_2 = await client.get_video(url_2) | ||
video_3 = await client.get_video(url_3) | ||
assert await video_1.download(downloader="threaded", quality="best") is True | ||
assert await video_2.download(downloader="threaded", quality="half") is True | ||
assert await video_3.download(downloader="threaded", quality="worst") is True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
from ..xvideos_api import Client | ||
import asyncio | ||
|
||
client = Client() | ||
pornstar = client.get_pornstar("https://de.xvideos.com/pornstars/sweetie-fox1") | ||
import pytest | ||
from ..xvideos_api import Client | ||
|
||
@pytest.mark.asyncio | ||
async def test_pornstar(): | ||
client = Client() | ||
pornstar = await client.get_pornstar("https://de.xvideos.com/pornstars/sweetie-fox1") | ||
|
||
def test_pornstar(): | ||
assert isinstance(pornstar.total_videos, int) | ||
assert isinstance(pornstar.total_pages, int) | ||
|
||
for idx, video in enumerate(pornstar.videos): | ||
for idx, video in enumerate(await pornstar.videos): | ||
assert isinstance(video.title, str) and len(video.title) >= 3 | ||
if idx == 3: | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1 @@ | ||
from ..xvideos_api import Client, Sort, SortVideoTime, SortQuality, SortDate, VideoUnavailable | ||
import pytest | ||
|
||
# Initialize client and query | ||
client = Client() | ||
query = "Mia Khalifa" | ||
|
||
def validate_video_objects(videos): | ||
"""Helper function to validate video objects.""" | ||
for idx, video in enumerate(videos): | ||
try: | ||
print(video.title) | ||
assert isinstance(video.title, str) and len(video.title) > 0, f"Invalid video title at index {idx}." | ||
if idx == 3: # Validate up to 4 videos for brevity | ||
break | ||
|
||
except VideoUnavailable: | ||
break # Expected | ||
|
||
|
||
@pytest.mark.parametrize("sort_option", [ | ||
Sort.Sort_rating, | ||
Sort.Sort_relevance, | ||
Sort.Sort_views, | ||
Sort.Sort_length, | ||
Sort.Sort_random, | ||
Sort.Sort_upload_date, | ||
]) | ||
def test_sort_search(sort_option): | ||
"""Test sorting by different Sort options.""" | ||
videos = client.search(query, sorting_sort=sort_option) | ||
validate_video_objects(videos) | ||
|
||
@pytest.mark.parametrize("time_option", [ | ||
SortVideoTime.Sort_long, | ||
SortVideoTime.Sort_all, | ||
SortVideoTime.Sort_short, | ||
SortVideoTime.Sort_middle, | ||
SortVideoTime.Sort_really_long, | ||
SortVideoTime.Sort_long_10_20min, | ||
]) | ||
def test_sort_video_time_search(time_option): | ||
"""Test sorting by different SortVideoTime options.""" | ||
videos = client.search(query, sorting_time=time_option) | ||
validate_video_objects(videos) | ||
|
||
@pytest.mark.parametrize("quality_option", [ | ||
SortQuality.Sort_720p, | ||
SortQuality.Sort_all, | ||
SortQuality.Sort_1080_plus, | ||
]) | ||
def test_sort_quality_search(quality_option): | ||
"""Test sorting by different SortQuality options.""" | ||
videos = client.search(query, sort_quality=quality_option) | ||
validate_video_objects(videos) | ||
|
||
@pytest.mark.parametrize("date_option", [ | ||
SortDate.Sort_all, | ||
SortDate.Sort_week, | ||
SortDate.Sort_month, | ||
SortDate.Sort_last_3_days, | ||
SortDate.Sort_last_3_months, | ||
SortDate.Sort_last_6_months, | ||
]) | ||
def test_sort_date_search(date_option): | ||
"""Test sorting by different SortDate options.""" | ||
videos = client.search(query, sorting_date=date_option) | ||
validate_video_objects(videos) | ||
|
||
def test_base_search(): | ||
"""Test basic search functionality.""" | ||
videos = client.search(query) | ||
validate_video_objects(videos) | ||
|
||
# Refactored by ChatGPT lol | ||
# Not implemented yet, too lazy lol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,27 @@ | ||
import pytest | ||
import asyncio | ||
from ..xvideos_api import Client | ||
|
||
url = "https://www.xvideos.com/video79875801/wow_what_a_dick_how_about_ass_fucking_" | ||
# This URL will be used for all tests | ||
@pytest.mark.asyncio | ||
async def test_video(): | ||
url = "https://www.xvideos.com/video79875801/wow_what_a_dick_how_about_ass_fucking_" | ||
# This URL will be used for all tests | ||
|
||
client = Client() | ||
video = client.get_video(url) | ||
client = Client() | ||
video = await client.get_video(url) | ||
|
||
|
||
def test_title(): | ||
assert isinstance(video.title, str) and len(video.title) > 0 | ||
|
||
|
||
def test_uploader(): | ||
assert isinstance(video.author, str) and len(video.author) > 0 | ||
|
||
|
||
def test_length(): | ||
assert isinstance(video.length, str) and len(video.length) > 0 | ||
|
||
|
||
def test_views(): | ||
assert isinstance(video.views, str) and len(video.views) > 0 | ||
|
||
|
||
def test_comment_count(): | ||
assert isinstance(video.comment_count, str) and len(video.comment_count) > 0 | ||
|
||
|
||
def test_likes(): | ||
assert isinstance(video.likes, str) and len(video.likes) > 0 | ||
|
||
|
||
def test_dislikes(): | ||
assert isinstance(video.dislikes, str) and len(video.dislikes) > 0 | ||
|
||
|
||
def test_rating_votes(): | ||
assert isinstance(video.rating_votes, str) and len(video.rating_votes) > 0 | ||
|
||
|
||
def test_description(): | ||
assert isinstance(video.description, str) and len(video.description) > 0 | ||
|
||
|
||
def test_tags(): | ||
assert isinstance(video.tags, list) and len(video.tags) > 0 | ||
|
||
|
||
def test_thumbnail_url(): | ||
assert isinstance(video.thumbnail_url, str) and len(video.thumbnail_url) > 0 | ||
|
||
|
||
def test_preview_video_url(): | ||
assert isinstance(video.preview_video_url, str) and len(video.preview_video_url) > 0 | ||
|
||
|
||
def test_publish_date(): | ||
assert isinstance(video.publish_date, str) and len(video.publish_date) > 0 | ||
|
||
|
||
def test_content_url(): | ||
assert isinstance(video.content_url, str) and len(video.content_url) > 0 | ||
|
||
|
||
def test_pornstars(): | ||
assert isinstance(video.pornstars, list) and len(video.pornstars) > 0 |
Oops, something went wrong.