4 Commits

Author SHA1 Message Date
TheOnlyWayUp 405cb7bcfe Exclude .epub from .gitignore 2024-07-08 12:15:12 +00:00
TheOnlyWayUp d819db27d3 Update VSCode settings.json 2024-07-08 12:14:59 +00:00
TheOnlyWayUp 3edd35829d feat(api/tests): Story testing 2024-07-08 12:14:38 +00:00
TheOnlyWayUp 0eedef7653 fix(api): Make package, for importing in tests 2024-07-08 12:14:08 +00:00
5 changed files with 38 additions and 2 deletions
-1
View File
@@ -1,6 +1,5 @@
__pycache__
venv
*epub
data
*ipynb
build
+7 -1
View File
@@ -1,3 +1,9 @@
{
"python.analysis.autoImportCompletions": true
"python.analysis.autoImportCompletions": true,
"vscord.app.privacyMode.enable": false,
"python.testing.pytestArgs": [
"src"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
View File
View File
+31
View File
@@ -0,0 +1,31 @@
from .. import create_book
import pytest
STORY_ID = 372219540
@pytest.mark.asyncio
async def test_retrieve_story():
story_data = await create_book.retrieve_story(STORY_ID)
story_data.pop("modifyDate", None) # Subject to change
response = {
"id": "372219540",
"title": "WPD Test",
"createDate": "2024-07-02T15:29:13Z",
# "modifyDate": "2024-07-02T15:41:26Z",
"language": {"name": "English"},
"user": {"username": "KindaAssNgl"},
"description": "Testing story for WPD.",
"cover": r"https:\/\/img.wattpad.com\/cover\/372219540-256-k908955.jpg",
"completed": False,
"tags": ["testing", "towu", "wpd"],
"mature": False,
"url": r"https:\/\/www.wattpad.com\/story\/372219540-wpd-test",
"parts": [{"id": 1458516761, "title": "Ganesh"}],
"isPaywalled": False,
}
assert story_data == response