def test_model_query_url(self): m = Model('postgresql', 'ajoy', 'ajoy', 'localhost', '5432', 'ajoy') urls = ['http://python.org', u'http://python.org', 'http://google.com', 'http://example.com/düsseldorf?neighbourhood=Lörick'] for url in urls: url_enc = urllib2.quote(url) id = m.add_url(url_enc) url_from_query = m.query_url(id) assert urllib2.unquote(url_from_query.encode('utf8')) == url