本文整理汇总了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"},
})
}
示例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")
}
示例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"},
})
}
示例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"},
})
}
示例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"},
})
}
示例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"},
})
}
示例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")
}
示例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"},
})
}
示例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"},
})
}
示例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"},
})
}
示例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"},
})
}
示例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"},
})
}
示例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"},
})
}
示例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, "")
}
示例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")
}