Pass selected ani-cli result to queue jobs

This commit is contained in:
Codex
2026-08-01 17:39:36 +02:00
parent 141dcd9c70
commit 32fc0f2829
6 changed files with 43 additions and 7 deletions
+17 -3
View File
@@ -1943,7 +1943,7 @@ class WatchlistCompletionTests(unittest.TestCase):
self.assertNotIn("-S", APP.app_support.command_for_job(job))
def test_command_for_job_ignores_legacy_result_index(self):
def test_command_for_job_includes_result_switch_for_selected_search_result(self):
command = APP.app_support.command_for_job(
{
"query": "Queue Show",
@@ -1954,6 +1954,20 @@ class WatchlistCompletionTests(unittest.TestCase):
}
)
self.assertIn("-S", command)
self.assertEqual(command[command.index("-S") + 1], "2")
def test_command_for_job_ignores_invalid_result_index(self):
command = APP.app_support.command_for_job(
{
"query": "Queue Show",
"quality": "best",
"episodes": "1-10",
"mode": "dub",
"result_index": "nope",
}
)
self.assertNotIn("-S", command)
def test_command_for_job_builds_anipy_fallback_search_spec(self):
@@ -4018,9 +4032,9 @@ class TemplateHelperTests(unittest.TestCase):
self.assertIn('const progress = `${job.completed || 0}/${job.total || 0} entries`;', APP.QUEUE_HTML)
self.assertIn('const moved = `${job.moved || 0} moved`;', APP.QUEUE_HTML)
def test_search_page_queues_selected_title_without_result_index(self):
def test_search_page_queues_selected_title_with_result_index(self):
self.assertIn('query: state.selected.title,', APP.INDEX_HTML)
self.assertNotIn('index: state.selected.index,', APP.INDEX_HTML)
self.assertIn('result_index: state.selected.index,', APP.INDEX_HTML)
def test_search_page_renders_poster_results_under_selection_panel(self):
self.assertIn('class="results-grid" id="results"', APP.INDEX_HTML)