diff --git a/.travis.yml b/.travis.yml index 2215762..10a5ea4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ install: - echo UWHOISD_HOME="'`pwd`'" > .env - pipenv run start.py - popd - - sleep 10 # Get back in the project directory - popd # Other Python deps @@ -43,8 +42,10 @@ before_script: script: - pipenv run start.py - - sleep 10 + - sleep 2 - pipenv run start_website.py & - - sleep 10 + - sleep 5 - curl http://0.0.0.0:5200/ - - sleep 20 + - pushd client + - python tests/tests.py + - popd diff --git a/client/pyurlabuse/api.py b/client/pyurlabuse/api.py index 31f4951..1536ef7 100644 --- a/client/pyurlabuse/api.py +++ b/client/pyurlabuse/api.py @@ -79,6 +79,10 @@ class PyURLAbuse(object): query = {'query': q} return self._async('psslcircl', query) + def lookyloo(self, q): + query = {'url': q} + return self._async('lookyloo', query) + def _update_cache(self, cached): for result in cached['result']: for url, items in result.items(): @@ -114,6 +118,7 @@ class PyURLAbuse(object): if has_cached_content: cached['info'] = 'Used cached content' return cached + self.lookyloo(q) job_id = self.urls(q) all_urls = None while True: diff --git a/client/tests/tests.py b/client/tests/tests.py new file mode 100644 index 0000000..bb3c8cb --- /dev/null +++ b/client/tests/tests.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import unittest + +from pyurlabuse import PyURLAbuse + +import json + + +class TestPyUrlAbuse(unittest.TestCase): + + def test_digest(self): + urlabuse = PyURLAbuse('http://0.0.0.0:5200') + response = urlabuse.run_query('https://circl.lu/url-abuse') + print(json.dumps(response, indent=2)) + self.assertTrue(response['result']) + +if __name__ == '__main__': + unittest.main()