Select Git revision

Sydney Anne Erickson authored
db_test.go 1.07 KiB
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2019 Privategrity Corporation /
// /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
package conf
import (
"gitlab.com/elixxir/primitives/utils"
"gopkg.in/yaml.v2"
"reflect"
"testing"
)
var ExpectedDatabase = Database{
Name: "name",
Username: "username",
Password: "password",
Address: "127.0.0.1:80",
}
// This test checks that unmarshalling the params.yaml file
// has the expected Database object.
func TestDB_UnmarshallingFileEqualsExpected(t *testing.T) {
buf, _ := utils.ReadFile("./params.yaml")
actual := Params{}
err := yaml.Unmarshal(buf, &actual)
if err != nil {
t.Errorf("Unable to decode into struct, %v", err)
}
if !reflect.DeepEqual(ExpectedDatabase, actual.Database) {
t.Errorf("Database object did not match value")
}
}