def test_multiple(self): q = Query(QueryTests.template) q.searchTerms = 'zx81' q.startIndex = 15 q.count = 15 self.assertEqual(q.url(), 'http://www.koders.com/?i=15&s=zx81&c=15&output=rss')
def test_multiple(self): q = Query(QueryTests.template) q.searchTerms = 'zx81' q.startIndex = 15 q.count = 15 self.assertEqual(q.url(), 'http://www.koders.com/?s=zx81&output=rss&c=15&i=15')
def test_extra_param(self): template = "http://www.koders.com/?s={searchTerms}&p={startPage}&output=rss&c={count}&i={startIndex}&key={key}" q = Query(template) self.assertTrue(q.has_macro('key')) q.searchTerms = 'zx81' q.key = 'abc123' self.assertEqual( q.url(), 'http://www.koders.com/?s=zx81&output=rss&key=abc123')
def test_prefix(self): template = "http://worldcat.org/webservices/catalog/search/worldcat/opensearch?q={searchTerms}&start={startIndex?}&count={resultSize?}&format=atom&wskey={wcapi:wskey}&cformat={wcapi:cformat?}" q = Query(template) self.assertTrue(q.has_macro('searchTerms')) self.assertTrue(q.has_macro('wcapi__wskey')) q.searchTerms = "computer" q.wcapi__wskey = "abc123" self.assertEqual( q.url(), 'http://worldcat.org/webservices/catalog/search/worldcat/opensearch?q=computer&format=atom&wskey=abc123' )
def test_searchTerms(self): q = Query(QueryTests.template) q.searchTerms = 'zx81' self.assertEqual(q.url(), 'http://www.koders.com/?s=zx81&output=rss')
def test_startIndex(self): q = Query(QueryTests.template) q.startIndex = 5 self.assertEqual(q.url(), 'http://www.koders.com/?i=5&output=rss')
def test_count(self): q = Query(QueryTests.template) q.count = 25 self.assertEqual(q.url(), 'http://www.koders.com/?c=25&output=rss')
def test_startIndex(self): q = Query(QueryTests.template) q.startIndex = 5 self.assertEqual(q.url(), 'http://www.koders.com/?output=rss&i=5')
def test_startPage(self): q = Query(QueryTests.template) q.startPage = 5 self.assertEqual(q.url(), 'http://www.koders.com/?p=5&output=rss')
def test_count(self): q = Query(QueryTests.template) q.count = 25 self.assertEqual(q.url(), 'http://www.koders.com/?output=rss&c=25')