mirror of
https://github.com/twofas/2fas-server.git
synced 2024-11-24 19:30:51 +01:00
browser extension "not blank" name validation during updates
This commit is contained in:
parent
8024b1db77
commit
35116e236f
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
type UpdateBrowserExtension struct {
|
type UpdateBrowserExtension struct {
|
||||||
BrowserExtensionId string `uri:"extension_id" validate:"required,uuid4"`
|
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"`
|
BrowserName string `json:"browser_name" validate:"lte=255"`
|
||||||
BrowserVersion string `json:"browser_version" validate:"lte=32"`
|
BrowserVersion string `json:"browser_version" validate:"lte=32"`
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,15 @@ func (s *BrowserExtensionTestSuite) TestUpdateNotExistingBrowserExtension() {
|
|||||||
assert.Equal(s.T(), 404, response.StatusCode)
|
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() {
|
func (s *BrowserExtensionTestSuite) TestDoNotFindNotExistingExtension() {
|
||||||
notExistingId := uuid.New()
|
notExistingId := uuid.New()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user