github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/model/plugin_key_value_test.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package model 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestPluginKeyIsValid(t *testing.T) { 13 kv := PluginKeyValue{PluginId: "someid", Key: "somekey", Value: []byte("somevalue")} 14 assert.Nil(t, kv.IsValid()) 15 16 kv.PluginId = "" 17 assert.NotNil(t, kv.IsValid()) 18 19 kv.PluginId = "someid" 20 kv.Key = "" 21 assert.NotNil(t, kv.IsValid()) 22 23 kv.Key = "this is an extremely long key and should be invalid and this is being verified in this test" 24 assert.NotNil(t, kv.IsValid()) 25 }