def test_get_pages(self): HTTPServer.routes() body = read_file('data/mediawiki_pages_all.json') client = MediaWikiClient(MEDIAWIKI_SERVER_URL) namespace = '0' response = client.get_pages(namespace) req = HTTPServer.requests_http[-1] self.assertEqual(response, body) self.assertEqual(req.method, 'GET') self.assertRegex(req.path, '/api.php') # Check request params expected = { 'action' : ['query'], 'list' : ['allpages'], 'apnamespace':['0'], 'aplimit':['max'], 'format':['json'] } self.assertDictEqual(req.querystring, expected)
def test_get_pages(self): HTTPServer.routes() body = read_file('data/mediawiki_pages_all.json') client = MediaWikiClient(MEDIAWIKI_SERVER_URL) namespace = '0' response = client.get_pages(namespace) req = HTTPServer.requests_http[-1] self.assertEqual(response, body) self.assertEqual(req.method, 'GET') self.assertRegex(req.path, '/api.php') # Check request params expected = { 'action': ['query'], 'list': ['allpages'], 'apnamespace': ['0'], 'aplimit': ['max'], 'format': ['json'] } self.assertDictEqual(req.querystring, expected)
def test_get_pages(self): HTTPServer.routes() body = read_file("data/mediawiki_pages_all.json") client = MediaWikiClient(MEDIAWIKI_SERVER_URL) namespace = "0" response = client.get_pages(namespace) req = HTTPServer.requests_http[-1] self.assertEqual(response, body) self.assertEqual(req.method, "GET") self.assertRegex(req.path, "/api.php") # Check request params expected = { "action": ["query"], "list": ["allpages"], "apnamespace": ["0"], "aplimit": ["max"], "format": ["json"], } self.assertDictEqual(req.querystring, expected)