mirror of https://github.com/CIRCL/url-abuse
new: Add test case
parent
7862d3ebb5
commit
64f01bf76e
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue