Skip to content

Commit

Permalink
[#553] Replace == with is when comparing to bool in test
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Mar 5, 2013
1 parent d13220c commit 1d6b899
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions 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

0 comments on commit 1d6b899

Please sign in to comment.