refactor: move TH structs and definitions to model (#894)
This commit moves the TH structs and definitions to model. We don't want oohelperd to depend on web_connectivity@v0.4. Part of https://github.com/ooni/probe/issues/2240
This commit is contained in:
parent
110a11828b
commit
bb6563f363
12 changed files with 161 additions and 157 deletions
|
|
@ -1,26 +1,23 @@
|
|||
package webconnectivity_test
|
||||
package webconnectivity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/mockable"
|
||||
)
|
||||
|
||||
func TestFillASNsEmpty(t *testing.T) {
|
||||
dns := new(webconnectivity.ControlDNSResult)
|
||||
dns.FillASNs(new(mockable.Session))
|
||||
dns := new(ControlDNSResult)
|
||||
fillASNs(dns)
|
||||
if diff := cmp.Diff(dns.ASNs, []int64{}); diff != "" {
|
||||
t.Fatal(diff)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFillASNsSuccess(t *testing.T) {
|
||||
sess := newsession(t, false)
|
||||
dns := new(webconnectivity.ControlDNSResult)
|
||||
dns := new(ControlDNSResult)
|
||||
dns.Addrs = []string{"8.8.8.8", "1.1.1.1"}
|
||||
dns.FillASNs(sess)
|
||||
fillASNs(dns)
|
||||
if diff := cmp.Diff(dns.ASNs, []int64{15169, 13335}); diff != "" {
|
||||
t.Fatal(diff)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue