def test_contents_pagination(self): """Test contents API call with pagination""" http_requests = setup_http_server() client = ConfluenceClient(CONFLUENCE_URL) pages = client.contents(max_contents=2) pages = [p for p in pages] self.assertEqual(len(pages), 2) expected = [ { 'cql': ["lastModified>='1970-01-01 00:00' order by lastModified"], 'limit': ['2'], 'expand': ['ancestors'] }, { 'cql': ["lastModified>='1970-01-01 00:00' order by lastModified"], 'start': ['2'], 'limit': ['2'] } ] self.assertEqual(len(http_requests), len(expected)) for i in range(len(expected)): self.assertDictEqual(http_requests[i].querystring, expected[i])
def test_contents(self): """Test contents API call""" http_requests = setup_http_server() client = ConfluenceClient(CONFLUENCE_URL) dt = datetime.datetime(2016, 7, 8, 0, 0, 0) pages = client.contents(from_date=dt, offset=10, max_contents=2) pages = [p for p in pages] self.assertEqual(len(pages), 1) expected = { 'cql': ["lastModified>='2016-07-08 00:00' order by lastModified"], 'start': ['10'], 'limit': ['2'] } self.assertEqual(len(http_requests), 1) self.assertDictEqual(http_requests[0].querystring, expected)