MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / cloudTutorialsServer

Function cloudTutorialsServer

internal/server/task3452_tutorials_test.go:49–65  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

47// cloudTutorialsServer is a cloud-mode server whose outbound client answers
48// from the fakes and counts what it was asked for.
49func 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
67func TestTASK3452_SelfHostedNeverFetchesAndAddsNoFrameSrc(t *testing.T) {
68 t.Parallel()

Calls 7

testServerFunction · 0.85
tutorialsRoundTripFuncType · 0.85
appendFunction · 0.85
tutorialsResponseFunction · 0.85
HelperMethod · 0.80
SetCloudModeMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected