MCPcopy
hub / github.com/go-sql-driver/mysql / TestDSNServerPubKeyQueryEscape

Function TestDSNServerPubKeyQueryEscape

dsn_test.go:192–207  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

190}
191
192func TestDSNServerPubKeyQueryEscape(t *testing.T) {
193 const name = "&%!:"
194 dsn := "User:password@tcp(localhost:5555)/dbname?serverPubKey=" + url.QueryEscape(name)
195
196 RegisterServerPubKey(name, testPubKeyRSA)
197 defer DeregisterServerPubKey(name)
198
199 cfg, err := ParseDSN(dsn)
200 if err != nil {
201 t.Error(err.Error())
202 }
203
204 if cfg.pubKey != testPubKeyRSA {
205 t.Error("pub key pointer doesn't match")
206 }
207}
208
209func TestDSNWithCustomTLS(t *testing.T) {
210 baseDSN := "User:password@tcp(localhost:5555)/dbname?tls="

Callers

nothing calls this directly

Calls 4

RegisterServerPubKeyFunction · 0.85
DeregisterServerPubKeyFunction · 0.85
ParseDSNFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected