add resilient multi-engine browser discovery
This commit is contained in:
@@ -30,6 +30,11 @@ class BrowserOnlyAppTests(unittest.TestCase):
|
||||
response = self.conn.getresponse()
|
||||
return response.status, json.loads(response.read() or b"{}")
|
||||
|
||||
def test_search_redirect_links_are_unwrapped(self):
|
||||
wrapped = "https://duckduckgo.com/l/?uddg=https%3A%2F%2Fwww.example.co.za%2Fservices"
|
||||
self.assertEqual(server.normalize_result_href(wrapped), "https://www.example.co.za/services")
|
||||
self.assertEqual(server.normalize_result_href("//example.co.za/about"), "https://example.co.za/about")
|
||||
|
||||
@patch("api.server.google_search", return_value=[{"name": "Acme Plumbing", "website": "https://www.acme.co.za", "domain": "acme.co.za"}, {"name": "Other", "website": "https://other.co.za", "domain": "other.co.za"}])
|
||||
def test_discovery_filters_catalogued_root_domains(self, search):
|
||||
status, first = self.request("POST", "/api/discover", {"category": "plumbers", "keywords": "plumbing", "location": "Cape Town", "max_results": 5})
|
||||
|
||||
Reference in New Issue
Block a user