Пример #1
0
    def test_model_add_url(self):
        m = Model('postgresql', 'ajoy', 'ajoy', 'localhost', '5432', 'ajoy')
        urls = [u'http://python.org', u'http://python.org', u'http://google.com']

        for url in urls:
            url_enc = urllib2.quote(url.encode('utf8'))
            id = m.add_url(url_enc)
            assert isinstance(id, int)
Пример #2
0
 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