Adding Tests for GetInfo
This commit is contained in:
parent
f82cf26731
commit
0c745e7691
|
@ -114,6 +114,10 @@ func (tp *torProvider) GetInfo(onion string) (map[string]string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cirucitID == "" {
|
||||||
|
return nil, errors.New("could not find circuit")
|
||||||
|
}
|
||||||
|
|
||||||
var hops []string
|
var hops []string
|
||||||
for _, circuit := range circuits {
|
for _, circuit := range circuits {
|
||||||
if circuit.Key == "circuit-status" {
|
if circuit.Key == "circuit-status" {
|
||||||
|
|
|
@ -43,6 +43,29 @@ func TestTorProvider(t *testing.T) {
|
||||||
t.Logf("progress: %v", progress)
|
t.Logf("progress: %v", progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test opening the OP Server
|
||||||
|
_, _, err = acn.Open("isbr2t6bflul2zyi6hjtnuezb2xvfr42svzjg2q3gyqfgg3wmnrbkkqd")
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
info, err := acn.GetInfo("isbr2t6bflul2zyi6hjtnuezb2xvfr42svzjg2q3gyqfgg3wmnrbkkqd")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not find info for OP server %v", err)
|
||||||
|
}
|
||||||
|
cinfo, exists := info["circuit"]
|
||||||
|
if !exists {
|
||||||
|
t.Fatalf("could not find circuit info for OP server %v", err)
|
||||||
|
}
|
||||||
|
t.Logf("Found Cicurit Info %v", cinfo)
|
||||||
|
|
||||||
|
_, err = acn.GetInfo("not_a_real_onion")
|
||||||
|
if err == nil {
|
||||||
|
t.Fatalf("GetInfo for non existant onion should have errored")
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
t.Fatalf("could not connect to OP server %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Should skip without blocking...
|
// Should skip without blocking...
|
||||||
acn.Restart()
|
acn.Restart()
|
||||||
acn.Restart()
|
acn.Restart()
|
||||||
|
|
Loading…
Reference in New Issue