MCPcopy
hub / github.com/usefathom/fathom / TestDatabaseURL

Function TestDatabaseURL

pkg/config/config_test.go:52–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestDatabaseURL(t *testing.T) {
53 data := []byte("FATHOM_DATABASE_URL=\"postgres://dbuser:dbsecret@dbhost:1234/dbname\"")
54 ioutil.WriteFile("env_values", data, 0644)
55 defer os.Remove("env_values")
56
57 LoadEnv("env_values")
58 cfg := Parse()
59 driver := "postgres"
60 url := "postgres://dbuser:dbsecret@dbhost:1234/dbname"
61 if cfg.Database.Driver != driver {
62 t.Errorf("Expected %#v, got %#v", driver, cfg.Database.Driver)
63 }
64 if cfg.Database.URL != url {
65 t.Errorf("Expected %#v, got %#v", url, cfg.Database.URL)
66 }
67}
68
69func TestRandomString(t *testing.T) {
70 r1 := randomString(10)

Callers

nothing calls this directly

Calls 2

LoadEnvFunction · 0.85
ParseFunction · 0.85

Tested by

no test coverage detected