當前位置: 首頁>>代碼示例>>Golang>>正文


Golang assert.SliceDoesNotContain函數代碼示例

本文整理匯總了Golang中testhelpers/assert.SliceDoesNotContain函數的典型用法代碼示例。如果您正苦於以下問題:Golang SliceDoesNotContain函數的具體用法?Golang SliceDoesNotContain怎麽用?Golang SliceDoesNotContain使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了SliceDoesNotContain函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestEmptyServicesList

func TestEmptyServicesList(t *testing.T) {
	serviceInstances := []cf.ServiceInstance{}
	serviceSummaryRepo := &testapi.FakeServiceSummaryRepo{
		GetSummariesInCurrentSpaceInstances: serviceInstances,
	}
	ui := &testterm.FakeUI{}

	token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
		Username: "my-user",
	})
	assert.NoError(t, err)
	org := cf.OrganizationFields{}
	org.Name = "my-org"
	space := cf.SpaceFields{}
	space.Name = "my-space"
	config := &configuration.Configuration{
		SpaceFields:        space,
		OrganizationFields: org,
		AccessToken:        token,
	}

	cmd := NewListServices(ui, config, serviceSummaryRepo)
	cmd.Run(testcmd.NewContext("services", []string{}))

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Getting services in org", "my-org", "my-space", "my-user"},
		{"OK"},
		{"No services found"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"name", "service", "plan", "bound apps"},
	})
}
開發者ID:nsnt,項目名稱:cli,代碼行數:33,代碼來源:list_services_test.go

示例2: TestLoggingInWithTooManyOrgsDoesNotShowOrgList

func TestLoggingInWithTooManyOrgsDoesNotShowOrgList(t *testing.T) {
	c := LoginTestContext{
		Inputs: []string{"api.example.com", "[email protected]", "password", "my-org-1", "my-space"},
	}

	callLogin(t, &c, func(c *LoginTestContext) {
		for i := 0; i < 60; i++ {
			id := strconv.Itoa(i)
			org := cf.Organization{}
			org.Guid = "my-org-guid-" + id
			org.Name = "my-org-" + id
			c.orgRepo.Organizations = append(c.orgRepo.Organizations, org)
		}

		c.orgRepo.FindByNameOrganization = c.orgRepo.Organizations[1]

		space1 := cf.Space{}
		space1.Guid = "my-space-guid"
		space1.Name = "my-space"

		space2 := cf.Space{}
		space2.Guid = "some-space-guid"
		space2.Name = "some-space"

		c.spaceRepo.Spaces = []cf.Space{space1, space2}
	})

	savedConfig := testconfig.SavedConfiguration

	testassert.SliceDoesNotContain(t, c.ui.Outputs, testassert.Lines{
		{"my-org-2"},
	})
	assert.Equal(t, c.orgRepo.FindByNameName, "my-org-1")
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-org-guid-1")
}
開發者ID:nsnt,項目名稱:cli,代碼行數:35,代碼來源:login_test.go

示例3: TestGetRequestWithMultipleHeaderFlags

func TestGetRequestWithMultipleHeaderFlags(t *testing.T) {
	deps := newCurlDependencies()

	runCurlWithInputs(deps, []string{"-H", "Content-Type:cat", "-H", "Content-Length:12", "/foo"})

	assert.Equal(t, deps.curlRepo.Header, "Content-Type:cat\nContent-Length:12")
	testassert.SliceDoesNotContain(t, deps.ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:10,代碼來源:curl_test.go

示例4: TestRequestWithMethodFlag

func TestRequestWithMethodFlag(t *testing.T) {
	deps := newCurlDependencies()

	runCurlWithInputs(deps, []string{"-X", "post", "/foo"})

	assert.Equal(t, deps.curlRepo.Method, "post")
	testassert.SliceDoesNotContain(t, deps.ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:10,代碼來源:curl_test.go

示例5: TestGetRequestWithDataFlag

func TestGetRequestWithDataFlag(t *testing.T) {
	deps := newCurlDependencies()

	runCurlWithInputs(deps, []string{"-d", "body content to upload", "/foo"})

	assert.Equal(t, deps.curlRepo.Body, "body content to upload")
	testassert.SliceDoesNotContain(t, deps.ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:10,代碼來源:curl_test.go

示例6: TestPushingWithDefaultManifestNotFound

func TestPushingWithDefaultManifestNotFound(t *testing.T) {
	deps := getPushDependencies()
	deps.appRepo.ReadNotFound = true
	deps.manifestRepo.ReadManifestManifest = singleAppManifest()
	deps.manifestRepo.ReadManifestErrors = manifest.ManifestErrors{syscall.ENOENT}

	ui := callPush(t, []string{"--no-route", "app-name"}, deps)

	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:12,代碼來源:push_test.go

示例7: TestPushingWithNoManifestFlag

func TestPushingWithNoManifestFlag(t *testing.T) {
	deps := getPushDependencies()
	deps.appRepo.ReadNotFound = true

	ui := callPush(t, []string{"--no-route", "--no-manifest", "app-name"}, deps)

	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"FAILED"},
		{"hacker-manifesto"},
	})

	assert.Equal(t, deps.manifestRepo.ReadManifestPath, "")
	assert.Equal(t, deps.appRepo.CreatedAppParams().Get("name").(string), "app-name")
}
開發者ID:nsnt,項目名稱:cli,代碼行數:14,代碼來源:push_test.go

示例8: TestCreateBuildpackWithPosition

func TestCreateBuildpackWithPosition(t *testing.T) {
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
	repo, bitsRepo := getRepositories()
	ui := callCreateBuildpack([]string{"my-buildpack", "my.war", "5"}, reqFactory, repo, bitsRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Creating buildpack", "my-buildpack"},
		{"OK"},
		{"Uploading buildpack", "my-buildpack"},
		{"OK"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:nsnt,項目名稱:cli,代碼行數:15,代碼來源:create_buildpack_test.go

示例9: TestGetRequestWithIncludeFlag

func TestGetRequestWithIncludeFlag(t *testing.T) {
	deps := newCurlDependencies()

	deps.curlRepo.ResponseHeader = "Content-Size:1024"
	deps.curlRepo.ResponseBody = "response for get"
	runCurlWithInputs(deps, []string{"-i", "/foo"})

	testassert.SliceContains(t, deps.ui.Outputs, testassert.Lines{
		{"Content-Size:1024"},
		{"response for get"},
	})
	testassert.SliceDoesNotContain(t, deps.ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:15,代碼來源:curl_test.go

示例10: TestCreateBuildpackWhenItAlreadyExists

func TestCreateBuildpackWhenItAlreadyExists(t *testing.T) {
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
	repo, bitsRepo := getRepositories()

	repo.CreateBuildpackExists = true
	ui := callCreateBuildpack([]string{"my-buildpack", "my.war", "5"}, reqFactory, repo, bitsRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Creating buildpack", "my-buildpack"},
		{"OK"},
		{"my-buildpack", "already exists"},
		{"tip", "update-buildpack"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:nsnt,項目名稱:cli,代碼行數:17,代碼來源:create_buildpack_test.go

示例11: TestRequestWithNoFlags

func TestRequestWithNoFlags(t *testing.T) {
	deps := newCurlDependencies()

	deps.curlRepo.ResponseHeader = "Content-Size:1024"
	deps.curlRepo.ResponseBody = "response for get"
	runCurlWithInputs(deps, []string{"/foo"})

	assert.Equal(t, deps.curlRepo.Method, "GET")
	assert.Equal(t, deps.curlRepo.Path, "/foo")
	testassert.SliceContains(t, deps.ui.Outputs, testassert.Lines{
		{"response for get"},
	})
	testassert.SliceDoesNotContain(t, deps.ui.Outputs, testassert.Lines{
		{"FAILED"},
		{"Content-Size:1024"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:17,代碼來源:curl_test.go

示例12: TestMarketplaceServicesWhenNotLoggedIn

func TestMarketplaceServicesWhenNotLoggedIn(t *testing.T) {
	serviceOfferings := []cf.ServiceOffering{}
	serviceRepo := &testapi.FakeServiceRepo{ServiceOfferings: serviceOfferings}

	config := &configuration.Configuration{}

	ui := callMarketplaceServices(t, config, serviceRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Getting services from marketplace..."},
		{"OK"},
		{"No service offerings found"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"service", "plans", "description"},
	})
}
開發者ID:nsnt,項目名稱:cli,代碼行數:17,代碼來源:marketplace_services_test.go

示例13: TestCreateBuildpackEnabled

func TestCreateBuildpackEnabled(t *testing.T) {
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
	repo, bitsRepo := getRepositories()
	ui := callCreateBuildpack([]string{"--enable", "my-buildpack", "my.war", "5"}, reqFactory, repo, bitsRepo)

	assert.NotNil(t, repo.CreateBuildpack.Enabled)
	assert.Equal(t, *repo.CreateBuildpack.Enabled, true)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"creating buildpack", "my-buildpack"},
		{"OK"},
		{"uploading buildpack", "my-buildpack"},
		{"OK"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"FAILED"},
	})
}
開發者ID:nsnt,項目名稱:cli,代碼行數:18,代碼來源:create_buildpack_test.go

示例14: TestCreateSpaceWhenItAlreadyExists

func TestCreateSpaceWhenItAlreadyExists(t *testing.T) {
	resetSpaceDefaults()
	defaultSpaceRepo.CreateSpaceExists = true
	ui := callCreateSpace(t, []string{"my-space"}, defaultReqFactory, defaultSpaceRepo, defaultOrgRepo, defaultUserRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Creating space", "my-space"},
		{"OK"},
		{"my-space", "already exists"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"Assigning", "my-user", "my-space", cf.SpaceRoleToUserInput[cf.SPACE_MANAGER]},
	})

	assert.Equal(t, defaultSpaceRepo.CreateSpaceName, "")
	assert.Equal(t, defaultSpaceRepo.CreateSpaceOrgGuid, "")
	assert.Equal(t, defaultUserRepo.SetSpaceRoleUserGuid, "")
	assert.Equal(t, defaultUserRepo.SetSpaceRoleSpaceGuid, "")
}
開發者ID:nsnt,項目名稱:cli,代碼行數:19,代碼來源:create_space_test.go

示例15: TestPushingAppWhenItAlreadyExistsAndNoHostFlagIsPresent

func TestPushingAppWhenItAlreadyExistsAndNoHostFlagIsPresent(t *testing.T) {
	deps := getPushDependencies()

	domain := cf.Domain{}
	domain.Name = "example.com"
	domain.Guid = "domain-guid"
	domain.Shared = true

	existingRoute := cf.RouteSummary{}
	existingRoute.Host = "existing-app"
	existingRoute.Domain = domain.DomainFields

	existingApp := cf.Application{}
	existingApp.Name = "existing-app"
	existingApp.Guid = "existing-app-guid"
	existingApp.Routes = []cf.RouteSummary{existingRoute}

	deps.appRepo.ReadApp = existingApp
	deps.appRepo.UpdateAppResult = existingApp
	deps.routeRepo.FindByHostAndDomainNotFound = true
	deps.domainRepo.ListSharedDomainsDomains = []cf.Domain{domain}

	ui := callPush(t, []string{"--no-hostname", "existing-app"}, deps)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Creating route", "example.com"},
		{"OK"},
		{"Binding", "example.com"},
	})
	testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
		{"existing-app.example.com"},
	})

	assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "example.com")
	assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "")
	assert.Equal(t, deps.routeRepo.CreatedHost, "")
	assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "domain-guid")
}
開發者ID:nsnt,項目名稱:cli,代碼行數:38,代碼來源:push_test.go


注:本文中的testhelpers/assert.SliceDoesNotContain函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。