コード例 #1
0
    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']
                    },
                    {
                     '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])
コード例 #2
0
    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']
        }, {
            '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])
コード例 #3
0
    def test_historical_content(self):
        """Test historical content API call"""

        http_requests = setup_http_server()

        client = ConfluenceClient(CONFLUENCE_URL)
        hc = client.historical_content(content_id='1', version='2')

        expected = {
                    'expand' : ['body.storage,history,version'],
                    'status' : ['historical'],
                    'version' : ['2']
                   }

        self.assertIsInstance(hc, str)
        self.assertDictEqual(http_requests[0].querystring, expected)
コード例 #4
0
    def test_historical_content(self):
        """Test historical content API call"""

        http_requests = setup_http_server()

        client = ConfluenceClient(CONFLUENCE_URL)
        hc = client.historical_content(content_id='1', version='2')

        expected = {
            'expand': ['body.storage,history,version'],
            'status': ['historical'],
            'version': ['2']
        }

        self.assertIsInstance(hc, str)
        self.assertDictEqual(http_requests[0].querystring, expected)
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
    def test_init(self):
        """Test initialization of parameters"""

        client = ConfluenceClient(CONFLUENCE_URL)
        self.assertEqual(client.base_url, CONFLUENCE_URL)