mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Stop inserting hashed plugin keys * Address comments * Remove else statement * Address comments * Add comment * Update as per comments * Refactor as per comments * Update plugin_key_value_store.go minor comment tweaks * fail on non StatusNotFound for original key query * idiomatic error handling, and do not clean up if insert fails
26 lines
607 B
Go
26 lines
607 B
Go
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPluginKeyIsValid(t *testing.T) {
|
|
kv := PluginKeyValue{PluginId: "someid", Key: "somekey", Value: []byte("somevalue")}
|
|
assert.Nil(t, kv.IsValid())
|
|
|
|
kv.PluginId = ""
|
|
assert.NotNil(t, kv.IsValid())
|
|
|
|
kv.PluginId = "someid"
|
|
kv.Key = ""
|
|
assert.NotNil(t, kv.IsValid())
|
|
|
|
kv.Key = "this is an extremely long key and should be invalid and this is being verified in this test"
|
|
assert.NotNil(t, kv.IsValid())
|
|
}
|