mirror of
https://github.com/safing/portmaster
synced 2025-04-11 06:29:11 +00:00
32 lines
565 B
Go
32 lines
565 B
Go
package resolver
|
|
|
|
import "testing"
|
|
|
|
func TestNameRecordStorage(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
testDomain := "Mk35mMqOWEHXSMk11MYcbjLOjTE8PQvDiAVUxf4BvwtgR.example.com."
|
|
testQuestion := "A"
|
|
|
|
testNameRecord := &NameRecord{
|
|
Domain: testDomain,
|
|
Question: testQuestion,
|
|
Resolver: &ResolverInfo{
|
|
Type: "dns",
|
|
},
|
|
}
|
|
|
|
err := testNameRecord.Save()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
r, err := GetNameRecord(testDomain, testQuestion)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if r.Domain != testDomain || r.Question != testQuestion {
|
|
t.Fatal("mismatch")
|
|
}
|
|
}
|