mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-16 05:41:13 +08:00
validate dns entry does not contain whitespace (#2512)
This commit is contained in:
@@ -400,6 +400,19 @@ func TestValidateDNSCreate(t *testing.T) {
|
||||
assert.NotNil(t, err)
|
||||
assert.Contains(t, err.Error(), "Field validation for 'Name' failed on the 'name_unique' tag")
|
||||
})
|
||||
t.Run("WhiteSpace", func(t *testing.T) {
|
||||
entry := models.DNSEntry{Address: "10.10.10.5", Name: "white space", Network: "skynet"}
|
||||
err := logic.ValidateDNSCreate(entry)
|
||||
assert.NotNil(t, err)
|
||||
assert.Contains(t, err.Error(), "Field validation for 'Name' failed on the 'whitespace' tag")
|
||||
})
|
||||
t.Run("AllSpaces", func(t *testing.T) {
|
||||
entry := models.DNSEntry{Address: "10.10.10.5", Name: " ", Network: "skynet"}
|
||||
err := logic.ValidateDNSCreate(entry)
|
||||
assert.NotNil(t, err)
|
||||
assert.Contains(t, err.Error(), "Field validation for 'Name' failed on the 'whitespace' tag")
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func createHost() {
|
||||
|
Reference in New Issue
Block a user