| 1 | package hostproxy |
| 2 | |
| 3 | import ( |
| 4 | "net/http" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestGnomeProxyManualAndPACFailure(t *testing.T) { |
| 9 | req, _ := http.NewRequest("GET", "https://cloud.debian.org/image", nil) |
| 10 | u, err := gnomeProxy(req, "org.gnome.system.proxy mode 'manual'\norg.gnome.system.proxy.https host '127.0.0.1'\norg.gnome.system.proxy.https port 7890\norg.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.1']") |
| 11 | if err != nil || u == nil || u.String() != "http://127.0.0.1:7890" { |
| 12 | t.Fatalf("proxy=%v err=%v", u, err) |
| 13 | } |
| 14 | if _, err := gnomeProxy(req, "org.gnome.system.proxy mode 'auto'"); err == nil { |
| 15 | t.Fatal("unsupported PAC became direct") |
| 16 | } |
| 17 | } |