mirror of
https://github.com/netzbegruenung/green-spider.git
synced 2024-05-03 09:33:42 +02:00
commit
cf656ad2d1
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ cache
|
||||||
webapp/node_modules
|
webapp/node_modules
|
||||||
secrets
|
secrets
|
||||||
temp
|
temp
|
||||||
|
__pycache__
|
||||||
|
|
10
.travis.yml
Normal file
10
.travis.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
language: python
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
|
||||||
|
install:
|
||||||
|
- make venv
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make test
|
3
Makefile
3
Makefile
|
@ -23,3 +23,6 @@ webapp: webapp/node_modules
|
||||||
|
|
||||||
serve-webapp:
|
serve-webapp:
|
||||||
cd docs && ../venv/bin/python -m http.server
|
cd docs && ../venv/bin/python -m http.server
|
||||||
|
|
||||||
|
test: venv
|
||||||
|
venv/bin/python ./test.py
|
||||||
|
|
|
@ -105,7 +105,7 @@ def derive_test_hostnames(hostname):
|
||||||
else:
|
else:
|
||||||
hostnames.add('www.' + hostname)
|
hostnames.add('www.' + hostname)
|
||||||
|
|
||||||
return list(hostnames)
|
return sorted(list(hostnames))
|
||||||
|
|
||||||
|
|
||||||
def reduce_urls(urllist):
|
def reduce_urls(urllist):
|
||||||
|
|
17
test.py
Normal file
17
test.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import unittest
|
||||||
|
import spider
|
||||||
|
|
||||||
|
class TestSpider(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_derive_test_hostnames1(self):
|
||||||
|
hn = spider.derive_test_hostnames('www.my-domain.de')
|
||||||
|
expected = ['my-domain.de', 'www.my-domain.de']
|
||||||
|
self.assertEqual(hn, expected)
|
||||||
|
|
||||||
|
def test_derive_test_hostnames2(self):
|
||||||
|
hn = spider.derive_test_hostnames('domain.de')
|
||||||
|
expected = ['domain.de', 'www.domain.de']
|
||||||
|
self.assertEqual(hn, expected)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
Reference in a new issue