1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package mobile
import (
"path/filepath"
"testing"
"github.com/armanlife/firefox-vpn-client/core/internal/config"
)
// The phone's proxy never sleeps: the setting is turned off on start,
// whatever the config said.
func TestPhoneNeverSleeps(t *testing.T) {
path := filepath.Join(t.TempDir(), config.FileName)
cfg := config.Default()
if cfg.Proxy.IdleSleep == 0 {
t.Fatal("the default sleeps; the phone turns it off")
}
if err := config.Save(path, cfg); err != nil {
t.Fatal(err)
}
if err := neverSleep(path); err != nil {
t.Fatal(err)
}
loaded, _, err := config.Load(path)
if err != nil {
t.Fatal(err)
}
if loaded.Proxy.IdleSleep != 0 {
t.Fatalf("idle_sleep %v", loaded.Proxy.IdleSleep)
}
}