mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 04:11:03 +00:00
cc30db44ac
* 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>
32 lines
714 B
Go
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
|
|
}
|
|
}
|