woodpecker/server/store/datastore/server_config_test.go
Anbraten cc30db44ac
Use asym key to sign webhooks (#916)
* use async key pair for webhooks

* fix tests

* fix linter

* improve code

* add key pair to database

* undo some changes

* more undo

* improve docs

* add api-endpoint

* add signaturne api endpoint

* fix error

* fix linting and test

* fix lint

* add test

* migration 006

* no need for migration

* replace httsign lib

* fix lint

Co-authored-by: 6543 <6543@obermui.de>
2022-06-01 20:06:27 +02:00

32 lines
714 B
Go

package datastore
import (
"testing"
"github.com/woodpecker-ci/woodpecker/server/model"
)
func TestServerConfigGetSet(t *testing.T) {
store, closer := newTestStore(t, new(model.ServerConfig))
defer closer()
serverConfig := &model.ServerConfig{
Key: "test",
Value: "wonderland",
}
if err := store.ServerConfigSet(serverConfig.Key, serverConfig.Value); err != nil {
t.Errorf("Unexpected error: insert secret: %s", err)
return
}
value, err := store.ServerConfigGet(serverConfig.Key)
if err != nil {
t.Errorf("Unexpected error: delete secret: %s", err)
return
}
if value != serverConfig.Value {
t.Errorf("Want server-config value %s, got %s", serverConfig.Value, value)
return
}
}