Merge #1285 Invalid scmurl on import should yield status 400

This commit is contained in:
Matt Prahl
2019-06-12 15:27:36 +00:00
2 changed files with 5 additions and 5 deletions

View File

@@ -397,7 +397,7 @@ class SCMHandler(BaseHandler):
if not get_scm_url_re().match(url):
log.error("The submitted scmurl %r is not valid" % url)
raise Forbidden("The submitted scmurl %s is not valid" % url)
raise ValidationError("The submitted scmurl %s is not valid" % url)
if not skip_branch and "branch" not in self.data:
log.error("Missing branch")

View File

@@ -1155,8 +1155,8 @@ class TestViews:
"The submitted scmurl https://src.stg.fedoraproject.org"
"/modules/testmodule.git is not valid"
)
assert data["status"] == 403
assert data["error"] == "Forbidden"
assert data["status"] == 400
assert data["error"] == "Bad Request"
@patch("module_build_service.auth.get_user", return_value=user)
@patch("module_build_service.scm.SCM")
@@ -1299,8 +1299,8 @@ class TestViews:
"The submitted scmurl {} is not allowed".format(scmurl),
"The submitted scmurl {} is not valid".format(scmurl),
)
assert data["status"] == 403
assert data["error"] == "Forbidden"
assert data["status"] in (400, 403)
assert data["error"] in ("Bad Request", "Forbidden")
@patch("module_build_service.auth.get_user", return_value=user)
@patch("module_build_service.scm.SCM")