diff --git a/ckan/tests/lib/test_datapreview.py b/ckan/tests/lib/test_datapreview.py index 2b39e6f7c78..ee41a7d5851 100644 --- a/ckan/tests/lib/test_datapreview.py +++ b/ckan/tests/lib/test_datapreview.py @@ -1,23 +1,25 @@ import ckan.lib.datapreview as datapreview + class TestDataPreview(): def test_compare_domains(self): ''' see https://en.wikipedia.org/wiki/Same_origin_policy ''' comp = datapreview.compare_domains - assert comp(['http://www.okfn.org', 'http://www.okfn.org']) == True - assert comp(['http://www.okfn.org', 'http://www.okfn.org', 'http://www.okfn.org']) == True - assert comp(['http://www.OKFN.org', 'http://www.okfn.org', 'http://www.okfn.org/test/foo.html']) == True - assert comp(['http://okfn.org', 'http://okfn.org']) == True - assert comp(['www.okfn.org', 'http://www.okfn.org']) == True - assert comp(['//www.okfn.org', 'http://www.okfn.org']) == True + assert comp(['http://www.okfn.org', 'http://www.okfn.org']) is True + assert comp(['http://www.okfn.org', 'http://www.okfn.org', 'http://www.okfn.org']) is True + assert comp(['http://www.OKFN.org', 'http://www.okfn.org', 'http://www.okfn.org/test/foo.html']) is True + assert comp(['http://okfn.org', 'http://okfn.org']) is True + assert comp(['www.okfn.org', 'http://www.okfn.org']) is True + assert comp(['//www.okfn.org', 'http://www.okfn.org']) is True + + assert comp(['http://www.okfn.org', 'https://www.okfn.org']) is False + assert comp(['http://www.okfn.org:80', 'http://www.okfn.org:81']) is False + assert comp(['http://www.okfn.org', 'http://www.okfn.de']) is False + assert comp(['http://de.okfn.org', 'http://www.okfn.org']) is False - assert comp(['http://www.okfn.org', 'https://www.okfn.org']) == False - assert comp(['http://www.okfn.org:80', 'http://www.okfn.org:81']) == False - assert comp(['http://www.okfn.org', 'http://www.okfn.de']) == False - assert comp(['http://de.okfn.org', 'http://www.okfn.org']) == False + assert comp(['http://de.okfn.org', 'http:www.foo.com']) is False - assert comp(['http://de.okfn.org', 'http:www.foo.com']) == False # Wrong URL. Makes urlparse choke - assert comp(['http://Server=cda3; Service=sde:sqlserver:cda3; Database=NationalDatasets; User=sde; Version=sde.DEFAULT', 'http://www.okf.org']) == False + assert comp(['http://Server=cda3; Service=sde:sqlserver:cda3; Database=NationalDatasets; User=sde; Version=sde.DEFAULT', 'http://www.okf.org']) is False