-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add methods for controling pyLoad and tests (#4)
Add new methods: pause, unpause, toggle_pause: : Pause/Resume download queue. stop_all_downloads: Abort all running downloads. restart_failed: Restart all failed files. toggle_reconnect: Toggle reconnect activation delete_finished: Delete all finished files and completly finished packages. restart: Restart pyload core. free_space: Get available free space at download directory in bytes. Add pytest unit testing for login method Refactored get_status and version methods
- Loading branch information
Showing
9 changed files
with
383 additions
and
34 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
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
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,6 +1,6 @@ | ||
[metadata] | ||
name = PyLoadAPI | ||
version = 1.0.3 | ||
version = 1.1.0 | ||
author = Manfred Dennerlein Rodelo | ||
author_email = [email protected] | ||
description = "Simple wrapper for pyLoad's API." | ||
|
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
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
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 @@ | ||
"""Tests for PyLoadAPI.""" |
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,53 @@ | ||
"""Fixtures for PyLoadAPI Tests.""" | ||
|
||
from typing import Any, AsyncGenerator, Generator | ||
|
||
import aiohttp | ||
from aioresponses import aioresponses | ||
from dotenv import load_dotenv | ||
import pytest | ||
|
||
from pyloadapi.api import PyLoadAPI | ||
|
||
load_dotenv() | ||
|
||
|
||
TEST_API_URL = "https://example.com:8000/" | ||
TEST_USERNAME = "test-username" | ||
TEST_PASSWORD = "test-password" | ||
TEST_LOGIN_RESPONSE = { | ||
"_permanent": True, | ||
"authenticated": True, | ||
"id": 2, | ||
"name": "test-username", | ||
"role": 0, | ||
"perms": 0, | ||
"template": "default", | ||
"_flashes": [["message", "Logged in successfully"]], | ||
} | ||
|
||
|
||
@pytest.fixture(name="session") | ||
async def aiohttp_client_session() -> AsyncGenerator[aiohttp.ClientSession, Any]: | ||
"""Create a client session.""" | ||
async with aiohttp.ClientSession() as session: | ||
yield session | ||
|
||
|
||
@pytest.fixture(name="pyload") | ||
async def mocked_pyloadapi_client(session: aiohttp.ClientSession) -> PyLoadAPI: | ||
"""Create Bring instance.""" | ||
pyload = PyLoadAPI( | ||
session, | ||
TEST_API_URL, | ||
TEST_USERNAME, | ||
TEST_PASSWORD, | ||
) | ||
return pyload | ||
|
||
|
||
@pytest.fixture(name="mocked_aiohttp") | ||
def aioclient_mock() -> Generator[aioresponses, Any, None]: | ||
"""Mock Aiohttp client requests.""" | ||
with aioresponses() as m: | ||
yield m |
Oops, something went wrong.