MCPcopy Index your code
hub / github.com/cloudfoundry/cli / testSpacesDidNotFindByNameWithOrg

Function testSpacesDidNotFindByNameWithOrg

cf/api/spaces/spaces_test.go:444–461  ·  view source on GitHub ↗
(orgGUID string, findByName func(SpaceRepository, string) (models.Space, error))

Source from the content-addressed store, hash-verified

442}
443
444func testSpacesDidNotFindByNameWithOrg(orgGUID string, findByName func(SpaceRepository, string) (models.Space, error)) {
445 request := apifakes.NewCloudControllerTestRequest(testnet.TestRequest{
446 Method: "GET",
447 Path: fmt.Sprintf("/v2/organizations/%s/spaces?q=name%%3Aspace1", orgGUID),
448 Response: testnet.TestResponse{
449 Status: http.StatusOK,
450 Body: ` { "resources": [ ] }`,
451 },
452 })
453
454 ts, handler, repo := createSpacesRepo(request)
455 defer ts.Close()
456
457 _, apiErr := findByName(repo, "Space1")
458 Expect(handler).To(HaveAllRequestsCalled())
459
460 Expect(apiErr.(*errors.ModelNotFoundError)).NotTo(BeNil())
461}
462
463func createSpacesRepo(reqs ...testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo SpaceRepository) {
464 ts, handler = testnet.NewServer(reqs)

Callers 1

spaces_test.goFile · 0.85

Calls 4

createSpacesRepoFunction · 0.85
HaveAllRequestsCalledFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected