MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / setupRegisterAgent

Method setupRegisterAgent

tests/contract/contract_test.go:277–296  ·  view source on GitHub ↗
(t *testing.T, a *agentSetup)

Source from the content-addressed store, hash-verified

275}
276
277func (r *runner) setupRegisterAgent(t *testing.T, a *agentSetup) {
278 t.Helper()
279 email := r.resolve(a.Email)
280 body, _ := json.Marshal(map[string]string{
281 "email": email,
282 })
283 req, _ := http.NewRequest("POST", r.env.baseURL+"/v1/agents", bytes.NewReader(body))
284 req.Header.Set("Authorization", "Bearer "+r.env.apiKey)
285 req.Header.Set("Content-Type", "application/json")
286 resp, err := http.DefaultClient.Do(req)
287 if err != nil {
288 t.Fatalf("setup register_agent: %v", err)
289 }
290 defer resp.Body.Close()
291 if resp.StatusCode != 201 {
292 respBody, _ := io.ReadAll(resp.Body)
293 t.Fatalf("setup register_agent: status %d; body: %s", resp.StatusCode, respBody)
294 }
295 r.vars["agent_email"] = email
296}
297
298func (r *runner) executeSteps(t *testing.T) {
299 for _, s := range r.sc.Steps {

Callers 1

executeSetupMethod · 0.95

Calls 2

resolveMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected