Repository navigation
Report Jackett setup errors in search results #464
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| eztv: 1.24 | ||
| jackett: 4.13 | ||
| jackett: 4.14 | ||
| limetorrents: 4.15 | ||
| piratebay: 3.10 | ||
| solidtorrents: 2.9 | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,7 @@ | ||||||||||||
| from __future__ import annotations | ||||||||||||
|
|
||||||||||||
| from unittest.mock import Mock | ||||||||||||
|
|
||||||||||||
| import pytest | ||||||||||||
|
|
||||||||||||
| from ..engines import jackett | ||||||||||||
|
Comment on lines
+1
to
7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, follow the coding style from #464 (comment) |
||||||||||||
|
|
@@ -8,5 +12,56 @@ def test_jackett(capfd: pytest.CaptureFixture[str]) -> None: | |||||||||||
| engine.search('linux', 'all') | ||||||||||||
|
|
||||||||||||
| capturedOutput = capfd.readouterr() | ||||||||||||
| assert capturedOutput.err == "" | ||||||||||||
| assert len(capturedOutput.out) >= 0 | ||||||||||||
|
Comment on lines
-11
to
-12
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this. |
||||||||||||
| assert capturedOutput.err or capturedOutput.out | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def test_jackett_reports_missing_api_key(capfd: pytest.CaptureFixture[str]) -> None: | ||||||||||||
| engine = jackett.jackett() | ||||||||||||
| engine.api_key = 'YOUR_API_KEY_HERE' | ||||||||||||
| engine.search('linux', 'all') | ||||||||||||
|
|
||||||||||||
| assert capfd.readouterr().err | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.mark.parametrize( | ||||||||||||
| 'response', | ||||||||||||
| [ | ||||||||||||
| None, | ||||||||||||
| '<indexers />', | ||||||||||||
| ], | ||||||||||||
| ) | ||||||||||||
| def test_jackett_reports_setup_errors(monkeypatch: pytest.MonkeyPatch, capfd: pytest.CaptureFixture[str], response: str | None) -> None: | ||||||||||||
| engine = jackett.jackett() | ||||||||||||
| engine.api_key = 'test-key' | ||||||||||||
| engine.thread_count = 1 | ||||||||||||
|
|
||||||||||||
| monkeypatch.setattr(engine, 'get_response', Mock(return_value=response)) | ||||||||||||
| engine.search('linux', 'all') | ||||||||||||
|
|
||||||||||||
| assert capfd.readouterr().err | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.mark.parametrize('response', [ | ||||||||||||
| '<indexers', | ||||||||||||
| '<error code="100" description="Invalid API Key" />', | ||||||||||||
| ]) | ||||||||||||
| def test_jackett_raises_for_bad_response(monkeypatch: pytest.MonkeyPatch, response: str) -> None: | ||||||||||||
| engine = jackett.jackett() | ||||||||||||
| engine.api_key = 'test-key' | ||||||||||||
|
|
||||||||||||
| monkeypatch.setattr(engine, 'get_response', Mock(return_value=response)) | ||||||||||||
|
|
||||||||||||
| with pytest.raises(RuntimeError): | ||||||||||||
| engine.search('linux', 'all') | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def test_jackett_checks_indexers_without_concurrency(monkeypatch: pytest.MonkeyPatch) -> None: | ||||||||||||
| engine = jackett.jackett() | ||||||||||||
| engine.api_key = 'test-key' | ||||||||||||
| engine.thread_count = 1 | ||||||||||||
| search_mock = Mock() | ||||||||||||
| monkeypatch.setattr(engine, 'get_response', Mock(return_value='<indexers><indexer id="thepiratebay" /></indexers>')) | ||||||||||||
|
Comment on lines
+62
to
+63
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| monkeypatch.setattr(engine, 'search_jackett_indexer', search_mock) | ||||||||||||
| engine.search('linux', 'all') | ||||||||||||
|
|
||||||||||||
| search_mock.assert_called_once_with('linux', None, 'all') | ||||||||||||
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.
you are already passing the error to stdout so don't do this.
@q5x-v6e-n7z-6x3
Clearly you are using AI. Please instruct your AI to follow/address the review comments closely and don't invent new ideas.