def assert_source_added( tester: CommandTester, poetry: Poetry, source_existing: Source, source_added: Source, ) -> None: assert ( tester.io.fetch_output().strip() == f"Adding source with name {source_added.name}." ) poetry.pyproject.reload() sources = poetry.get_sources() assert sources == [source_existing, source_added] assert tester.status_code == 0
def test_source_add_existing( tester: CommandTester, source_existing: Source, poetry_with_source: Poetry ): tester.execute(f"--default {source_existing.name} {source_existing.url}") assert ( tester.io.fetch_output().strip() == f"Source with name {source_existing.name} already exists. Updating." ) poetry_with_source.pyproject.reload() sources = poetry_with_source.get_sources() assert len(sources) == 1 assert sources[0] != source_existing assert sources[0] == dataclasses.replace(source_existing, default=True)
def test_source_remove_simple( tester: CommandTester, poetry_with_source: Poetry, source_existing: Source, source_one: Source, source_two: Source, ): tester.execute(f"{source_existing.name}") assert (tester.io.fetch_output().strip() == f"Removing source with name {source_existing.name}.") poetry_with_source.pyproject.reload() sources = poetry_with_source.get_sources() assert sources == [source_one, source_two] assert tester.status_code == 0