diff --git a/tests/unit/oidc/forms/test_github.py b/tests/unit/oidc/forms/test_github.py index 095ba61e44bd..212b165eead5 100644 --- a/tests/unit/oidc/forms/test_github.py +++ b/tests/unit/oidc/forms/test_github.py @@ -47,10 +47,11 @@ def check_project_name(name): assert form._check_project_name == check_project_name assert form.validate() - def test_validate_project_name_already_in_use(self): + @pytest.mark.parametrize("reason", list(ProjectNameUnavailableReason)) + def test_validate_project_name_unavailable(self, reason): form = github.PendingGitHubPublisherForm( api_token="fake-token", - check_project_name=lambda name: ProjectNameUnavailableReason.AlreadyExists, + check_project_name=lambda name: reason, ) field = pretend.stub(data="some-project") diff --git a/warehouse/packaging/services.py b/warehouse/packaging/services.py index e4202e2754b3..0ce6e9f656f3 100644 --- a/warehouse/packaging/services.py +++ b/warehouse/packaging/services.py @@ -537,8 +537,6 @@ def create_project( projecthelp=request.help_url(_anchor="project-name"), ), ) from None - case None: - pass # The project name is valid: create it and add it project = Project(name=name)