def test_get_project_returns_the_project(ltd_client: ListTheDocs): ltd_client.add_project( Project(title='test_project', description='A very long string')) project = ltd_client.get_project('test_project') assert project.code == 'test_project' assert project.title == 'test_project' assert project.description == 'A very long string' assert project.logo is None
def test_delete_project(ltd_client: ListTheDocs): ltd_client.add_project( Project(title='test_project1', description='description1')) ltd_client.add_version('test_project1', Version('1.0.0', 'www.example.com/index.html')) ltd_client.delete_project('test_project1') project = ltd_client.get_project('test_project1') assert project is None
def test_remove_version(ltd_client: ListTheDocs): ltd_client.add_project( Project(title='test_project1', description='description1')) # Add multiple versions ltd_client.add_version( 'test_project1', Version('1.0.0', 'www.example.com/1.0.0/index.html')) ltd_client.add_version( 'test_project1', Version('2.0.0', 'www.example.com/2.0.0/index.html')) # Remove a version ltd_client.delete_version('test_project1', '1.0.0') project = ltd_client.get_project('test_project1') assert project.code == 'test_project1' assert project.title == 'test_project1' assert project.description == 'description1' assert len(project.versions) == 1 assert project.versions[0].name == '2.0.0' assert project.versions[0].url == 'www.example.com/2.0.0/index.html'
def test_update_version_link(ltd_client: ListTheDocs): ltd_client.add_project( Project(title='test_project1', description='description1')) # Add multiple versions ltd_client.add_version( 'test_project1', Version('1.0.0', 'www.example.com/1.0.0/index.html')) ltd_client.add_version( 'test_project1', Version('2.0.0', 'www.example.com/2.0.0/index.html')) ltd_client.update_version('test_project1', '2.0.0', url='www.newexample.com/2.0.0/index.html') project = ltd_client.get_project('test_project1') assert project.code == 'test_project1' assert project.title == 'test_project1' assert project.description == 'description1' assert len(project.versions) == 2 assert project.versions[0].name == '1.0.0' assert project.versions[0].url == 'www.example.com/1.0.0/index.html' assert project.versions[1].name == '2.0.0' assert project.versions[1].url == 'www.newexample.com/2.0.0/index.html'
def test_get_missing_project(ltd_client: ListTheDocs): project = ltd_client.get_project('test_project') assert project is None