mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 19:40:27 +00:00
30 lines
577 B
Go
30 lines
577 B
Go
package sqlstore
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestConfigDSN(t *testing.T) {
|
|
c := Config{
|
|
Driver: "postgres",
|
|
User: "john",
|
|
Password: "foo",
|
|
}
|
|
e := fmt.Sprintf("user=%s password=%s", c.User, c.Password)
|
|
if v := c.DSN(); v != e {
|
|
t.Errorf("Invalid DSN. Expected %s, got %s", e, v)
|
|
}
|
|
|
|
c = Config{
|
|
Driver: "postgres",
|
|
User: "john",
|
|
Password: "foo",
|
|
SSLMode: "disable",
|
|
}
|
|
e = fmt.Sprintf("user=%s password=%s sslmode=%s", c.User, c.Password, c.SSLMode)
|
|
if v := c.DSN(); v != e {
|
|
t.Errorf("Invalid DSN. Expected %s, got %s", e, v)
|
|
}
|
|
}
|