def test_api_url_from_page_link(expected, link): if link.startswith('/x/'): page_id = api.page_id_from_tiny_link(link) assert page_id == int(expected.split('/')[-1]) cf = api.ConfluenceAPI(endpoint='https://confluence.example.com/') api_url = cf.url(cf.base_url + link) assert api_url == cf.base_url + expected
def test_error_for_malformed_tiny_link(): with pytest.raises(ValueError): url = 'https://confluence.example.com/x/#' api.page_id_from_tiny_link(url)
def test_error_for_malformed_tiny_link(): with pytest.raises(ValueError): url = "https://confluence.example.com/x/#" api.page_id_from_tiny_link(url)
def test_tiny_link_is_parsed(): url = 'https://confluence.example.com/x/ZqQ8' page_id = api.page_id_from_tiny_link(url) assert page_id == 3974246
def test_tiny_link_is_parsed(): url = "https://confluence.example.com/x/ZqQ8" page_id = api.page_id_from_tiny_link(url) assert page_id == 3974246