oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package fakeopencode
2
3import (
4 "crypto/tls"
5 "net/http"
6 "testing"
7)
8
9// Security round finding 8: the fake Go records every request it is
10// sent, whatever its path, before it routes it, so a test sees stray
11// traffic on the one allowed host.
12func TestGoRecordsEveryRequest(t *testing.T) {
13 g := StartGo(t)
14 c := &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}
15 for _, path := range []string{"/api/share", "/inference/go/v1/models", "/telemetry"} {
16 resp, err := c.Get("https://" + g.Addr + path)
17 if err != nil {
18 t.Fatal(err)
19 }
20 resp.Body.Close()
21 }
22 seen := g.Seen()
23 if len(seen) != 3 || seen[0].Path != "/api/share" || seen[0].Method != "GET" || seen[2].Path != "/telemetry" {
24 t.Fatalf("seen %+v", seen)
25 }
26}
27