Skip to content
Snippets Groups Projects
Commit 68f2f074 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[tests] fix gateways tests

parent 006bfb04
No related branches found
No related tags found
No related merge requests found
......@@ -7,4 +7,5 @@ var (
Auth = ""
APIURL = ""
GeolocationAPI = ""
)
var CaCert = []byte("")
......@@ -40,7 +40,7 @@ type gatewayPool struct {
available []Gateway
userChoice []byte
/* ranked is, for now, just an array of hostnames (fetched from the
geoip service). it should be a map in the future, to keep track of
menshen service). it should be a map in the future, to keep track of
quantitative metrics */
ranked []string
......
......@@ -37,28 +37,28 @@ func TestGatewayPool(t *testing.T) {
t.Fatal("gatewayPool labels not what expected. Got:", labels)
}
if pool.userChoice != "" {
if pool.userChoice != nil {
t.Fatal("userChoice should be empty by default")
}
err = pool.setUserChoice("foo")
err = pool.setUserChoice([]byte("foo"))
if err == nil {
t.Fatal("gatewayPool should not let you set a foo gateway")
}
err = pool.setUserChoice("a-1")
err = pool.setUserChoice([]byte("a-1"))
if err != nil {
t.Fatal("location 'a-1' should be a valid label")
}
err = pool.setUserChoice("c-2")
err = pool.setUserChoice([]byte("c-2"))
if err != nil {
t.Fatal("location 'c-2' should be a valid label")
}
if pool.userChoice != "c-2" {
if string(pool.userChoice) != "c-2" {
t.Fatal("userChoice should be c-2")
}
pool.setAutomaticChoice()
if pool.userChoice != "" {
if string(pool.userChoice) != "" {
t.Fatal("userChoice should be empty after auto selection")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment