def test_repository_name_not_extracted_warning(): """If provided an invalid repository url, should raise warning and return original repository url""" repository_url = "https://github.com:organ[ization/repository-name" with mock.patch("ddtrace.contrib.pytest.plugin.log") as mock_log: extracted_repository_name = _extract_repository_name(repository_url) assert extracted_repository_name == repository_url mock_log.warning.assert_called_once_with("Repository name cannot be parsed from repository_url: %s", repository_url)
def test_repository_name_extracted(repository_url, repository_name): assert _extract_repository_name(repository_url) == repository_name