-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix AllDebrid downloader tests #922
test: fix AllDebrid downloader tests #922
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe pull request introduces several modifications to the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (3)
src/tests/test_alldebrid_downloader.py (3)
8-8
: Remove unused importAllDebridRequestHandler
The imported
AllDebridRequestHandler
is not used in this file.Apply this diff to remove the unused import:
from program.services.downloaders.alldebrid import ( AllDebridDownloader, - AllDebridRequestHandler, )
🧰 Tools
🪛 Ruff (0.8.0)
8-8:
program.services.downloaders.alldebrid.AllDebridRequestHandler
imported but unusedRemove unused import:
program.services.downloaders.alldebrid.AllDebridRequestHandler
(F401)
59-59
: Simplify assertion by removing unnecessary comparison toTrue
In Python, you can assert the expression directly without comparing to
True
.Apply this diff:
-def test_validate(downloader): - assert downloader.validate() == True +def test_validate(downloader): + assert downloader.validate()🧰 Tools
🪛 Ruff (0.8.0)
59-59: Avoid equality comparisons to
True
; useif downloader.validate():
for truth checksReplace with
downloader.validate()
(E712)
74-74
: Useis None
when comparing toNone
In Python, comparisons to
None
should useis None
rather than== None
.Apply this diff:
- assert downloader.select_files(MAGNET_ID, [1, 2, 3]) == None + assert downloader.select_files(MAGNET_ID, [1, 2, 3]) is None🧰 Tools
🪛 Ruff (0.8.0)
74-74: Comparison to
None
should becond is None
Replace with
cond is None
(E711)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
src/program/services/downloaders/alldebrid.py
(9 hunks)src/tests/test_alldebrid_downloader.py
(3 hunks)src/tests/test_data/alldebrid_magnet_files.json
(1 hunks)src/tests/test_data/alldebrid_user.json
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- src/program/services/downloaders/alldebrid.py
- src/tests/test_data/alldebrid_magnet_files.json
- src/tests/test_data/alldebrid_user.json
🧰 Additional context used
🪛 Ruff (0.8.0)
src/tests/test_alldebrid_downloader.py
8-8: program.services.downloaders.alldebrid.AllDebridRequestHandler
imported but unused
Remove unused import: program.services.downloaders.alldebrid.AllDebridRequestHandler
(F401)
59-59: Avoid equality comparisons to True
; use if downloader.validate():
for truth checks
Replace with downloader.validate()
(E712)
74-74: Comparison to None
should be cond is None
Replace with cond is None
(E711)
78-78: Local variable torrent_info
is assigned to but never used
Remove assignment to unused variable torrent_info
(F841)
83-83: Comparison to None
should be cond is None
Replace with cond is None
(E711)
🔇 Additional comments (1)
src/tests/test_alldebrid_downloader.py (1)
145-150
: Ensure test data files exist and paths are correct
Verify that the file alldebrid_magnet_files.json
exists at the specified path and is accessible during test execution.
Run the following script to check for the existence of the required test data file:
✅ Verification successful
Test data file exists at the specified path
The file alldebrid_magnet_files.json
exists at the expected location src/tests/test_data/alldebrid_magnet_files.json
, confirming that the test will be able to access the required test data.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if 'alldebrid_magnet_files.json' exists in 'src/tests/test_data/'
# Test: Find the file. Expect: Path to the file if it exists.
fd 'alldebrid_magnet_files.json' src/tests/test_data/
Length of output: 101
|
||
def test_get_instant_availability(downloader): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is currently failing due to bugs in the downloader, @dreulavelle has a fix in his branch
cbae948
to
2d840f6
Compare
af5d32b
to
476e4c7
Compare
476e4c7
to
4411959
Compare
6b3d5ac
into
rivenmedia:feature/uncached_downloading
Pull Request Check List
Description: Fix AllDebrid downloader tests
The tests were broken through the many recent refactors, as well as the API changes
AllDebrid made recently.
This PR updates the tests to ensure it conforms to the BaseDownloader API, removes
some cruft, and adds a fixture for the
magnet/files
endpoint (which we now depend on).Summary by CodeRabbit
New Features
agent
attribute in the AllDebrid request parameters for enhanced customization.add_torrent
,delete_torrent
, andselect_files
.Bug Fixes
Tests