cloudTutorialsServer is a cloud-mode server whose outbound client answers from the fakes and counts what it was asked for.
(t *testing.T, catalogStatus int)
| 47 | // cloudTutorialsServer is a cloud-mode server whose outbound client answers |
| 48 | // from the fakes and counts what it was asked for. |
| 49 | func cloudTutorialsServer(t *testing.T, catalogStatus int) (*Server, *[]string) { |
| 50 | t.Helper() |
| 51 | srv := testServer(t) |
| 52 | srv.SetCloudMode("secret-for-tutorials") |
| 53 | var asked []string |
| 54 | srv.tutorialsHTTP = &http.Client{Timeout: time.Second, Transport: tutorialsRoundTrip(func(r *http.Request) (*http.Response, error) { |
| 55 | asked = append(asked, r.URL.String()) |
| 56 | switch r.URL.String() { |
| 57 | case tutorialsCatalogURL: |
| 58 | return tutorialsResponse(catalogStatus, "application/json", tutorialsTestCatalog), nil |
| 59 | case "https://www.getpad.dev/learn/new-project.jpg": |
| 60 | return tutorialsResponse(200, "image/jpeg", "JPEGBYTES"), nil |
| 61 | } |
| 62 | return tutorialsResponse(404, "text/plain", "no"), nil |
| 63 | })} |
| 64 | return srv, &asked |
| 65 | } |
| 66 | |
| 67 | func TestTASK3452_SelfHostedNeverFetchesAndAddsNoFrameSrc(t *testing.T) { |
| 68 | t.Parallel() |
no test coverage detected