browser extension "not blank" name validation during updates

This commit is contained in:
in-void 2023-03-18 15:30:42 +01:00
parent 8024b1db77
commit 35116e236f
2 changed files with 10 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import (
type UpdateBrowserExtension struct {
BrowserExtensionId string `uri:"extension_id" validate:"required,uuid4"`
Name string `json:"name" validate:"lte=64"`
Name string `json:"name" validate:"not_blank,lte=64"`
BrowserName string `json:"browser_name" validate:"lte=255"`
BrowserVersion string `json:"browser_version" validate:"lte=32"`
}

View File

@ -66,6 +66,15 @@ func (s *BrowserExtensionTestSuite) TestUpdateNotExistingBrowserExtension() {
assert.Equal(s.T(), 404, response.StatusCode)
}
func (s *BrowserExtensionTestSuite) TestUpdateBrowserExtensionSetEmptyName() {
browserExt := tests.CreateBrowserExtension(s.T(), "go-test")
payload := []byte(`{"name": ""}`)
response := tests.DoPut("/browser_extensions/"+browserExt.Id, payload, nil)
assert.Equal(s.T(), 400, response.StatusCode)
}
func (s *BrowserExtensionTestSuite) TestDoNotFindNotExistingExtension() {
notExistingId := uuid.New()