本文整理汇总了Golang中github.com/rackspace/gophercloud/testhelper.CheckDeepEquals函数的典型用法代码示例。如果您正苦于以下问题:Golang CheckDeepEquals函数的具体用法?Golang CheckDeepEquals怎么用?Golang CheckDeepEquals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckDeepEquals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestListMembers
func TestListMembers(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleMemberListSuccessfully(t)
pages := 0
err := ListAssociateMembers(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853", MemberListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
pages++
actual, err := ExtractMembers(page)
if err != nil {
return false, err
}
if len(actual) != 2 {
t.Fatalf("Expected 2 members, got %d", len(actual))
}
th.CheckDeepEquals(t, MemberWeb, actual[0])
th.CheckDeepEquals(t, MemberDb, actual[1])
return true, nil
})
th.AssertNoErr(t, err)
if pages != 1 {
t.Errorf("Expected 1 page, saw %d", pages)
}
}
开发者ID:sstrato,项目名称:gophercloud,代码行数:29,代码来源:requests_test.go
示例2: TestList
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandlePolicyListSuccessfully(t)
pages := 0
pager := List(client.ServiceClient(), "60b15dad-5ea1-43fa-9a12-a1d737b4da07")
err := pager.EachPage(func(page pagination.Page) (bool, error) {
pages++
policies, err := ExtractPolicies(page)
if err != nil {
return false, err
}
if len(policies) != 3 {
t.Fatalf("Expected 3 policies, got %d", len(policies))
}
th.CheckDeepEquals(t, WebhookPolicy, policies[0])
th.CheckDeepEquals(t, OneTimePolicy, policies[1])
th.CheckDeepEquals(t, SundayAfternoonPolicy, policies[2])
return true, nil
})
th.AssertNoErr(t, err)
if pages != 1 {
t.Errorf("Expected 1 page, saw %d", pages)
}
}
开发者ID:sstrato,项目名称:gophercloud,代码行数:34,代码来源:requests_test.go
示例3: TestListServers
func TestListServers(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleServerListSuccessfully(t)
pages := 0
err := List(client.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
pages++
actual, err := ExtractServers(page)
if err != nil {
return false, err
}
if len(actual) != 2 {
t.Fatalf("Expected 2 servers, got %d", len(actual))
}
th.CheckDeepEquals(t, ServerHerp, actual[0])
th.CheckDeepEquals(t, ServerDerp, actual[1])
return true, nil
})
th.AssertNoErr(t, err)
if pages != 1 {
t.Errorf("Expected 1 page, saw %d", pages)
}
}
开发者ID:hortonworks,项目名称:kubernetes-yarn,代码行数:29,代码来源:requests_test.go
示例4: GetIsSuccessful
// GetIsSuccessful ensures that a GetResult was successful and contains the correct token and
// User Info.
func GetIsSuccessful(t *testing.T, result GetResult) {
token, err := result.ExtractToken()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedToken, token)
user, err := result.ExtractUser()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedUser, user)
}
开发者ID:40a,项目名称:bootkube,代码行数:11,代码来源:fixtures.go
示例5: IsSuccessful
// IsSuccessful ensures that a CreateResult was successful and contains the correct token and
// service catalog.
func IsSuccessful(t *testing.T, result CreateResult) {
token, err := result.ExtractToken()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedToken, token)
serviceCatalog, err := result.ExtractServiceCatalog()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedServiceCatalog, serviceCatalog)
}
开发者ID:RaulKite,项目名称:machine,代码行数:11,代码来源:fixtures.go
示例6: TestMaybeString
func TestMaybeString(t *testing.T) {
testString := ""
var expected *string
actual := MaybeString(testString)
th.CheckDeepEquals(t, expected, actual)
testString = "carol"
expected = &testString
actual = MaybeString(testString)
th.CheckDeepEquals(t, expected, actual)
}
开发者ID:hortonworks,项目名称:kubernetes-yarn,代码行数:11,代码来源:params_test.go
示例7: TestMaybeInt
func TestMaybeInt(t *testing.T) {
testInt := 0
var expected *int
actual := MaybeInt(testInt)
th.CheckDeepEquals(t, expected, actual)
testInt = 4
expected = &testInt
actual = MaybeInt(testInt)
th.CheckDeepEquals(t, expected, actual)
}
开发者ID:hortonworks,项目名称:kubernetes-yarn,代码行数:11,代码来源:params_test.go
示例8: TestApplyDefaultsToEndpointOpts
func TestApplyDefaultsToEndpointOpts(t *testing.T) {
eo := EndpointOpts{Availability: AvailabilityPublic}
eo.ApplyDefaults("compute")
expected := EndpointOpts{Availability: AvailabilityPublic, Type: "compute"}
th.CheckDeepEquals(t, expected, eo)
eo = EndpointOpts{Type: "compute"}
eo.ApplyDefaults("object-store")
expected = EndpointOpts{Availability: AvailabilityPublic, Type: "compute"}
th.CheckDeepEquals(t, expected, eo)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:11,代码来源:endpoint_search_test.go
示例9: TestListAllServers
func TestListAllServers(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleServerListSuccessfully(t)
allPages, err := List(client.ServiceClient(), ListOpts{}).AllPages()
th.AssertNoErr(t, err)
actual, err := ExtractServers(allPages)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ServerHerp, actual[0])
th.CheckDeepEquals(t, ServerDerp, actual[1])
}
开发者ID:rtgoodwin,项目名称:cs-reboot-info,代码行数:12,代码来源:requests_test.go
示例10: TestListAllMembers
func TestListAllMembers(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleMemberListSuccessfully(t)
allPages, err := ListAssociateMembers(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853", MemberListOpts{}).AllPages()
th.AssertNoErr(t, err)
actual, err := ExtractMembers(allPages)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, MemberWeb, actual[0])
th.CheckDeepEquals(t, MemberDb, actual[1])
}
开发者ID:sstrato,项目名称:gophercloud,代码行数:12,代码来源:requests_test.go
示例11: TestListAllHealthmonitors
func TestListAllHealthmonitors(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleHealthmonitorListSuccessfully(t)
allPages, err := List(fake.ServiceClient(), ListOpts{}).AllPages()
th.AssertNoErr(t, err)
actual, err := ExtractMonitors(allPages)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, HealthmonitorWeb, actual[0])
th.CheckDeepEquals(t, HealthmonitorDb, actual[1])
}
开发者ID:sstrato,项目名称:gophercloud,代码行数:12,代码来源:requests_test.go
示例12: TestMeterStatistics
func TestMeterStatistics(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleMeterStatisticsSuccessfully(t)
list, err := MeterStatistics(client.ServiceClient(), "memory", MeterStatisticsOpts{}).Extract()
th.AssertNoErr(t, err)
if len(list) != 2 {
t.Fatalf("Expected 2 statistics, got %d", len(list))
}
th.CheckDeepEquals(t, StatisticsHerp, (list)[0])
th.CheckDeepEquals(t, StatisticsDerp, (list)[1])
}
开发者ID:dudymas,项目名称:gophercloud,代码行数:14,代码来源:requests_test.go
示例13: TestListMeters
func TestListMeters(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleMeterListSuccessfully(t)
list, err := List(client.ServiceClient(), ListOpts{}).Extract()
th.AssertNoErr(t, err)
if len(list) != 2 {
t.Fatalf("Expected 2 meters, got %d", len(list))
}
th.CheckDeepEquals(t, MeterHerp, (list)[0])
th.CheckDeepEquals(t, MeterDerp, (list)[1])
}
开发者ID:dudymas,项目名称:gophercloud,代码行数:14,代码来源:requests_test.go
示例14: TestRole
func TestRole(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockListRoleResponse(t)
count := 0
err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := os.ExtractRoles(page)
if err != nil {
t.Errorf("Failed to extract users: %v", err)
return false, err
}
expected := []os.Role{
os.Role{
ID: "123",
Name: "compute:admin",
Description: "Nova Administrator",
ServiceID: "cke5372ebabeeabb70a0e702a4626977x4406e5",
},
}
th.CheckDeepEquals(t, expected, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, count)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:33,代码来源:delegate_test.go
示例15: TestListByServer
func TestListByServer(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockListGroupsByServerResponse(t, serverID)
count := 0
err := ListByServer(client.ServiceClient(), serverID).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractSecurityGroups(page)
if err != nil {
t.Errorf("Failed to extract users: %v", err)
return false, err
}
expected := []SecurityGroup{
SecurityGroup{
ID: groupID,
Description: "default",
Name: "default",
Rules: []Rule{},
TenantID: "openstack",
},
}
th.CheckDeepEquals(t, expected, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, count)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:34,代码来源:requests_test.go
示例16: TestEnumerateMarker
func TestEnumerateMarker(t *testing.T) {
pager := createMarkerPaged(t)
defer testhelper.TeardownHTTP()
callCount := 0
err := pager.EachPage(func(page Page) (bool, error) {
actual, err := ExtractMarkerStrings(page)
if err != nil {
return false, err
}
t.Logf("Handler invoked with %v", actual)
var expected []string
switch callCount {
case 0:
expected = []string{"aaa", "bbb", "ccc"}
case 1:
expected = []string{"ddd", "eee", "fff"}
case 2:
expected = []string{"ggg", "hhh", "iii"}
default:
t.Fatalf("Unexpected call count: %d", callCount)
return false, nil
}
testhelper.CheckDeepEquals(t, expected, actual)
callCount++
return true, nil
})
testhelper.AssertNoErr(t, err)
testhelper.AssertEquals(t, callCount, 3)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:34,代码来源:marker_test.go
示例17: TestListImageDetails
func TestListImageDetails(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/images/detail", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
w.Header().Add("Content-Type", "application/json")
r.ParseForm()
marker := r.Form.Get("marker")
switch marker {
case "":
fmt.Fprintf(w, ListOutput)
case "e19a734c-c7e6-443a-830c-242209c4d65d":
fmt.Fprintf(w, `{ "images": [] }`)
default:
t.Fatalf("Unexpected marker: [%s]", marker)
}
})
count := 0
err := ListDetail(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractImages(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedImageSlice, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, 1, count)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:33,代码来源:delegate_test.go
示例18: TestListProtocols
func TestListProtocols(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockListProtocolsResponse(t)
count := 0
err := ListProtocols(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractProtocols(page)
th.AssertNoErr(t, err)
expected := []Protocol{
Protocol{Name: "DNS_TCP", Port: 53},
Protocol{Name: "DNS_UDP", Port: 53},
Protocol{Name: "FTP", Port: 21},
Protocol{Name: "HTTP", Port: 80},
Protocol{Name: "HTTPS", Port: 443},
Protocol{Name: "IMAPS", Port: 993},
Protocol{Name: "IMAPv4", Port: 143},
}
th.CheckDeepEquals(t, expected[0:7], actual)
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, count)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:31,代码来源:requests_test.go
示例19: TestList
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleList(t)
expectedDBs := []Database{
Database{Name: "anotherexampledb"},
Database{Name: "exampledb"},
Database{Name: "nextround"},
Database{Name: "sampledb"},
Database{Name: "testingdb"},
}
pages := 0
err := List(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) {
pages++
actual, err := ExtractDBs(page)
if err != nil {
return false, err
}
th.CheckDeepEquals(t, expectedDBs, actual)
return true, nil
})
th.AssertNoErr(t, err)
if pages != 1 {
t.Errorf("Expected 1 page, saw %d", pages)
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:33,代码来源:requests_test.go
示例20: TestListCerts
func TestListCerts(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockListCertsResponse(t, lbID)
count := 0
err := ListCerts(client.ServiceClient(), lbID).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractCerts(page)
th.AssertNoErr(t, err)
expected := []Certificate{
Certificate{ID: 123, HostName: "rackspace.com"},
Certificate{ID: 124, HostName: "*.rackspace.com"},
}
th.CheckDeepEquals(t, expected, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, count)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:26,代码来源:requests_test.go
注:本文中的github.com/rackspace/gophercloud/testhelper.CheckDeepEquals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论