Skip to content

Commit 61b05f1

Browse files
author
Philip Johansson
committed
only use _MIN_REQUEST_INTERVAL when downloading torrents
1 parent 1e4222d commit 61b05f1

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/murid/clients/myanonamouse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ def search(self, query: MyAnonamouseQuery) -> list[Torrent]:
8080

8181
logger.debug("Searching MyAnonamouse for %s", query.text)
8282
try:
83-
response = self._request(
84-
"POST",
83+
response = self.session.post(
8584
self.SEARCH_URL,
8685
json=payload,
8786
timeout=30,

tests/clients/test_myanonamouse.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
from unittest.mock import patch
2+
from unittest.mock import Mock, patch
33

44
import pytest
55
import requests
@@ -182,8 +182,10 @@ def test_parse_torrent_multiple_authors():
182182
]
183183

184184

185-
def test_search_uses_request_wrapper(mam):
185+
def test_download_torrent_uses_request_wrapper(mam):
186186
class Response:
187+
content = b"torrent data"
188+
187189
def raise_for_status(self):
188190
pass
189191

@@ -198,8 +200,9 @@ def fake_request(*args, **kwargs):
198200
return Response()
199201

200202
mam._request = fake_request
203+
torrent = Mock()
201204

202-
mam.search(MyAnonamouseQuery(text="Dune"))
205+
mam.download_torrent(torrent)
203206

204207
assert called
205208

0 commit comments

Comments
 (0)