feat: add init with host resolution and search verify check
Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
f190f770c4
commit
d76fe86f3a
@@ -38,3 +38,18 @@ class TestJingyuSpider(unittest.TestCase):
|
||||
self.spider.host = "http://test.com"
|
||||
result = self.spider._api_post("someEndpoint")
|
||||
self.assertEqual(result, payload)
|
||||
|
||||
def test_init_fetches_host_from_site_url(self):
|
||||
init_encrypted = self.spider._aes_encrypt(json.dumps({"type_list": []}))
|
||||
|
||||
class FakeInitResponse:
|
||||
status_code = 200
|
||||
encoding = "utf-8"
|
||||
text = "http://example.com"
|
||||
def json(self):
|
||||
return {"data": init_encrypted}
|
||||
|
||||
self.spider.fetch = lambda url, **kwargs: FakeInitResponse()
|
||||
self.spider.post = lambda url, **kwargs: FakeInitResponse()
|
||||
self.spider.init()
|
||||
self.assertEqual(self.spider.host, "http://example.com")
|
||||
|
||||
Reference in New Issue
Block a user