@@ -11,7 +11,6 @@ import (
1111 "testing"
1212
1313 "github.com/apex/log"
14- "github.com/google/go-cmp/cmp"
1514 "github.com/ooni/probe-cli/v3/internal/experiment/riseupvpn"
1615 "github.com/ooni/probe-cli/v3/internal/experiment/urlgetter"
1716 "github.com/ooni/probe-cli/v3/internal/legacy/mockable"
@@ -623,105 +622,6 @@ func TestMissingTransport(t *testing.T) {
623622 }
624623}
625624
626- func TestSummaryKeysInvalidType (t * testing.T ) {
627- measurement := new (model.Measurement )
628- m := & riseupvpn.Measurer {}
629- _ , err := m .GetSummaryKeys (measurement )
630- if err .Error () != "invalid test keys type" {
631- t .Fatal ("not the error we expected" )
632- }
633- }
634-
635- func TestSummaryKeysWorksAsIntended (t * testing.T ) {
636- tests := []struct {
637- tk riseupvpn.TestKeys
638- sk riseupvpn.SummaryKeys
639- }{{
640- tk : riseupvpn.TestKeys {
641- APIStatus : "blocked" ,
642- CACertStatus : true ,
643- FailingGateways : nil ,
644- TransportStatus : nil ,
645- },
646- sk : riseupvpn.SummaryKeys {
647- APIBlocked : true ,
648- ValidCACert : true ,
649- IsAnomaly : true ,
650- TransportStatus : nil ,
651- FailingGateways : 0 ,
652- },
653- }, {
654- tk : riseupvpn.TestKeys {
655- APIStatus : "ok" ,
656- CACertStatus : false ,
657- FailingGateways : nil ,
658- TransportStatus : nil ,
659- },
660- sk : riseupvpn.SummaryKeys {
661- ValidCACert : false ,
662- IsAnomaly : true ,
663- FailingGateways : 0 ,
664- TransportStatus : nil ,
665- },
666- }, {
667- tk : riseupvpn.TestKeys {
668- APIStatus : "ok" ,
669- CACertStatus : true ,
670- FailingGateways : []riseupvpn.GatewayConnection {{
671- IP : "1.1.1.1" ,
672- Port : 443 ,
673- TransportType : "obfs4" ,
674- }},
675- TransportStatus : map [string ]string {
676- "obfs4" : "blocked" ,
677- "openvpn" : "ok" ,
678- },
679- },
680- sk : riseupvpn.SummaryKeys {
681- FailingGateways : 1 ,
682- IsAnomaly : true ,
683- ValidCACert : true ,
684- TransportStatus : map [string ]string {
685- "obfs4" : "blocked" ,
686- "openvpn" : "ok" ,
687- },
688- },
689- }, {
690- tk : riseupvpn.TestKeys {
691- APIStatus : "ok" ,
692- CACertStatus : true ,
693- FailingGateways : nil ,
694- TransportStatus : map [string ]string {
695- "openvpn" : "ok" ,
696- },
697- },
698- sk : riseupvpn.SummaryKeys {
699- ValidCACert : true ,
700- IsAnomaly : false ,
701- FailingGateways : 0 ,
702- TransportStatus : map [string ]string {
703- "openvpn" : "ok" ,
704- },
705- },
706- },
707- }
708- for idx , tt := range tests {
709- t .Run (fmt .Sprintf ("%d" , idx ), func (t * testing.T ) {
710- m := & riseupvpn.Measurer {}
711- measurement := & model.Measurement {TestKeys : & tt .tk }
712- got , err := m .GetSummaryKeys (measurement )
713- if err != nil {
714- t .Fatal (err )
715- return
716- }
717- sk := got .(riseupvpn.SummaryKeys )
718- if diff := cmp .Diff (tt .sk , sk ); diff != "" {
719- t .Fatal (diff )
720- }
721- })
722- }
723- }
724-
725625func generateMockGetter (requestResponse map [string ]string , responseStatus map [string ]bool ) urlgetter.MultiGetter {
726626 return func (ctx context.Context , g urlgetter.Getter ) (urlgetter.TestKeys , error ) {
727627 url := g .Target
0 commit comments