本文整理汇总了Golang中github.com/gophercloud/gophercloud/testhelper.AssertEquals函数的典型用法代码示例。如果您正苦于以下问题:Golang AssertEquals函数的具体用法?Golang AssertEquals怎么用?Golang AssertEquals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertEquals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/extensions/agent", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, `
{
"extension": {
"updated": "2013-02-03T10:00:00-00:00",
"name": "agent",
"links": [],
"namespace": "http://docs.openstack.org/ext/agent/api/v2.0",
"alias": "agent",
"description": "The agent management extension."
}
}
`)
})
ext, err := extensions.Get(fake.ServiceClient(), "agent").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, ext.Updated, "2013-02-03T10:00:00-00:00")
th.AssertEquals(t, ext.Name, "agent")
th.AssertEquals(t, ext.Namespace, "http://docs.openstack.org/ext/agent/api/v2.0")
th.AssertEquals(t, ext.Alias, "agent")
th.AssertEquals(t, ext.Description, "The agent management extension.")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:34,代码来源:delegate_test.go
示例2: TestMemberListEmpty
func TestMemberListEmpty(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleImageMemberEmptyList(t)
pager := members.List(fakeclient.ServiceClient(), "da3b75d9-3f4a-40e7-8a2c-bfab23927dea")
t.Logf("Pager state %v", pager)
count, pages := 0, 0
err := pager.EachPage(func(page pagination.Page) (bool, error) {
pages++
t.Logf("Page %v", page)
members, err := members.ExtractMembers(page)
if err != nil {
return false, err
}
for _, i := range members {
t.Logf("%s\t%s\t%s\t%s\t\n", i.ImageID, i.MemberID, i.Status, i.Schema)
count++
}
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 0, pages)
th.AssertEquals(t, 0, count)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例3: TestUpdate
func TestUpdate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleUpdate(t)
options := portsbinding.UpdateOpts{
UpdateOptsBuilder: ports.UpdateOpts{
Name: "new_port_name",
FixedIPs: []ports.IP{
{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"},
},
SecurityGroups: []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"},
},
HostID: "HOST1",
VNICType: "normal",
}
s, err := portsbinding.Update(fake.ServiceClient(), "65c0ee9f-d634-4522-8954-51021b570b0d", options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, s.Name, "new_port_name")
th.AssertDeepEquals(t, s.FixedIPs, []ports.IP{
{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"},
})
th.AssertDeepEquals(t, s.SecurityGroups, []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"})
th.AssertEquals(t, s.HostID, "HOST1")
th.AssertEquals(t, s.VNICType, "normal")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例4: TestListImage
func TestListImage(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleImageListSuccessfully(t)
t.Logf("Test setup %+v\n", th.Server)
t.Logf("Id\tName\tOwner\tChecksum\tSizeBytes")
pager := images.List(fakeclient.ServiceClient(), images.ListOpts{Limit: 1})
t.Logf("Pager state %v", pager)
count, pages := 0, 0
err := pager.EachPage(func(page pagination.Page) (bool, error) {
pages++
t.Logf("Page %v", page)
images, err := images.ExtractImages(page)
if err != nil {
return false, err
}
for _, i := range images {
t.Logf("%s\t%s\t%s\t%s\t%v\t\n", i.ID, i.Name, i.Owner, i.Checksum, i.SizeBytes)
count++
}
return true, nil
})
th.AssertNoErr(t, err)
t.Logf("--------\n%d images listed on %d pages.\n", count, pages)
th.AssertEquals(t, 3, pages)
th.AssertEquals(t, 3, count)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:34,代码来源:requests_test.go
示例5: TestFetch
// test the fetch function
func TestFetch(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
baseurl, err := getBasePath()
th.AssertNoErr(t, err)
fakeURL := strings.Join([]string{baseurl, "file.yaml"}, "/")
urlparsed, err := url.Parse(fakeURL)
th.AssertNoErr(t, err)
th.Mux.HandleFunc(urlparsed.Path, func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
w.Header().Set("Content-Type", "application/jason")
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "Fee-fi-fo-fum")
})
client := fakeClient{BaseClient: getHTTPClient()}
te := TE{
URL: "file.yaml",
client: client,
}
err = te.Fetch()
th.AssertNoErr(t, err)
th.AssertEquals(t, fakeURL, te.URL)
th.AssertEquals(t, "Fee-fi-fo-fum", string(te.Bin))
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:27,代码来源:utils_test.go
示例6: TestUpdate
func TestUpdate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/subnets/08eae331-0402-425a-923c-34f7cfe39c1b", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "PUT")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
th.TestHeader(t, r, "Content-Type", "application/json")
th.TestHeader(t, r, "Accept", "application/json")
th.TestJSONRequest(t, r, `
{
"subnet": {
"name": "my_new_subnet",
"dns_nameservers": ["foo"],
"host_routes": [{"destination":"","nexthop": "bar"}]
}
}
`)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusCreated)
fmt.Fprintf(w, `
{
"subnet": {
"name": "my_new_subnet",
"enable_dhcp": true,
"network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
"tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
"dns_nameservers": [],
"allocation_pools": [
{
"start": "10.0.0.2",
"end": "10.0.0.254"
}
],
"host_routes": [],
"ip_version": 4,
"gateway_ip": "10.0.0.1",
"cidr": "10.0.0.0/24",
"id": "08eae331-0402-425a-923c-34f7cfe39c1b"
}
}
`)
})
opts := subnets.UpdateOpts{
Name: "my_new_subnet",
DNSNameservers: []string{"foo"},
HostRoutes: []subnets.HostRoute{
{NextHop: "bar"},
},
}
s, err := subnets.Update(fake.ServiceClient(), "08eae331-0402-425a-923c-34f7cfe39c1b", opts).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, s.Name, "my_new_subnet")
th.AssertEquals(t, s.ID, "08eae331-0402-425a-923c-34f7cfe39c1b")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:59,代码来源:requests_test.go
示例7: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/security-groups/85cc3048-abc3-43cc-89b3-377341426ac5", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, `
{
"security_group": {
"description": "default",
"id": "85cc3048-abc3-43cc-89b3-377341426ac5",
"name": "default",
"security_group_rules": [
{
"direction": "egress",
"ethertype": "IPv6",
"id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",
"port_range_max": null,
"port_range_min": null,
"protocol": null,
"remote_group_id": null,
"remote_ip_prefix": null,
"security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550"
},
{
"direction": "egress",
"ethertype": "IPv4",
"id": "93aa42e5-80db-4581-9391-3a608bd0e448",
"port_range_max": null,
"port_range_min": null,
"protocol": null,
"remote_group_id": null,
"remote_ip_prefix": null,
"security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550"
}
],
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550"
}
}
`)
})
sg, err := groups.Get(fake.ServiceClient(), "85cc3048-abc3-43cc-89b3-377341426ac5").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, "default", sg.Description)
th.AssertEquals(t, "85cc3048-abc3-43cc-89b3-377341426ac5", sg.ID)
th.AssertEquals(t, "default", sg.Name)
th.AssertEquals(t, 2, len(sg.Rules))
th.AssertEquals(t, "e4f50856753b4dc6afee5fa6b9b6c550", sg.TenantID)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:58,代码来源:requests_test.go
示例8: TestUpdate
func TestUpdate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "PUT")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
th.TestHeader(t, r, "Content-Type", "application/json")
th.TestHeader(t, r, "Accept", "application/json")
th.TestJSONRequest(t, r, `
{
"network": {
"name": "new_network_name",
"admin_state_up": false,
"shared": true
}
}
`)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, `
{
"network": {
"status": "ACTIVE",
"subnets": [
"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
],
"name": "private-network",
"provider:physical_network": null,
"admin_state_up": true,
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
"provider:network_type": "local",
"shared": true,
"id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
"provider:segmentation_id": null
}
}
`)
})
iTrue := true
options := networks.UpdateOpts{Name: "new_network_name", AdminStateUp: gophercloud.Disabled, Shared: &iTrue}
res := networks.Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options)
n, err := provider.ExtractUpdate(res)
th.AssertNoErr(t, err)
th.AssertEquals(t, "", n.PhysicalNetwork)
th.AssertEquals(t, "local", n.NetworkType)
th.AssertEquals(t, "", n.SegmentationID)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:53,代码来源:results_test.go
示例9: TestUpdate
func TestUpdate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/lb/vips/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "PUT")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
th.TestHeader(t, r, "Content-Type", "application/json")
th.TestHeader(t, r, "Accept", "application/json")
th.TestJSONRequest(t, r, `
{
"vip": {
"connection_limit": 1000,
"session_persistence": {"type": "SOURCE_IP"}
}
}
`)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusAccepted)
fmt.Fprintf(w, `
{
"vip": {
"status": "PENDING_UPDATE",
"protocol": "HTTP",
"description": "",
"admin_state_up": true,
"subnet_id": "8032909d-47a1-4715-90af-5153ffe39861",
"tenant_id": "83657cfcdfe44cd5920adaf26c48ceea",
"connection_limit": 1000,
"pool_id": "61b1f87a-7a21-4ad3-9dda-7f81d249944f",
"address": "10.0.0.11",
"protocol_port": 80,
"port_id": "f7e6fe6a-b8b5-43a8-8215-73456b32e0f5",
"id": "c987d2be-9a3c-4ac9-a046-e8716b1350e2",
"name": "NewVip"
}
}
`)
})
i1000 := 1000
options := vips.UpdateOpts{
ConnLimit: &i1000,
Persistence: &vips.SessionPersistence{Type: "SOURCE_IP"},
}
vip, err := vips.Update(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304", options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, "PENDING_UPDATE", vip.Status)
th.AssertEquals(t, 1000, vip.ConnLimit)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:53,代码来源:requests_test.go
示例10: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockGetResponse(t)
v, err := volumes.Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, v.Name, "vol-001")
th.AssertEquals(t, v.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
}
开发者ID:gophercloud,项目名称:gophercloud,代码行数:12,代码来源:requests_test.go
示例11: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/ports/46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, `
{
"port": {
"status": "ACTIVE",
"name": "",
"admin_state_up": true,
"network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
"tenant_id": "7e02058126cc4950b75f9970368ba177",
"device_owner": "network:router_interface",
"mac_address": "fa:16:3e:23:fd:d7",
"fixed_ips": [
{
"subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
"ip_address": "10.0.0.1"
}
],
"id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2",
"security_groups": [],
"device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e"
}
}
`)
})
n, err := ports.Get(fake.ServiceClient(), "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, n.Status, "ACTIVE")
th.AssertEquals(t, n.Name, "")
th.AssertEquals(t, n.AdminStateUp, true)
th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7")
th.AssertEquals(t, n.TenantID, "7e02058126cc4950b75f9970368ba177")
th.AssertEquals(t, n.DeviceOwner, "network:router_interface")
th.AssertEquals(t, n.MACAddress, "fa:16:3e:23:fd:d7")
th.AssertDeepEquals(t, n.FixedIPs, []ports.IP{
{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.1"},
})
th.AssertEquals(t, n.ID, "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2")
th.AssertDeepEquals(t, n.SecurityGroups, []string{})
th.AssertEquals(t, n.Status, "ACTIVE")
th.AssertEquals(t, n.DeviceID, "5e3898d7-11be-483e-9732-b2f5eccd2b2e")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:53,代码来源:requests_test.go
示例12: TestGetExtraSpecs
// Verifies that it is possible to get the extra specifications for a share type
func TestGetExtraSpecs(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockGetExtraSpecsResponse(t)
st, err := sharetypes.GetExtraSpecs(client.ServiceClient(), "shareTypeID").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, st["snapshot_support"], "True")
th.AssertEquals(t, st["driver_handles_share_servers"], "True")
th.AssertEquals(t, st["my_custom_extra_spec"], "False")
}
开发者ID:gophercloud,项目名称:gophercloud,代码行数:14,代码来源:requests_test.go
示例13: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockGetResponse(t)
vt, err := volumetypes.Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract()
th.AssertNoErr(t, err)
th.AssertDeepEquals(t, vt.ExtraSpecs, map[string]interface{}{"serverNumber": "2"})
th.AssertEquals(t, vt.Name, "vol-type-001")
th.AssertEquals(t, vt.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:13,代码来源:requests_test.go
示例14: TestCreate
func TestCreate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockCreateResponse(t)
options := &volumes.CreateOpts{Size: 75}
n, err := volumes.Create(client.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, n.Size, 4)
th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:13,代码来源:requests_test.go
示例15: TestCreate
func TestCreate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockCreateResponse(t)
options := snapshots.CreateOpts{VolumeID: "1234", Name: "snapshot-001"}
n, err := snapshots.Create(client.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, n.VolumeID, "1234")
th.AssertEquals(t, n.Name, "snapshot-001")
th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:14,代码来源:requests_test.go
示例16: TestCreate
func TestCreate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockCreateResponse(t)
options := &shares.CreateOpts{Size: 1, Name: "my_test_share", ShareProto: "NFS"}
n, err := shares.Create(client.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, n.Name, "my_test_share")
th.AssertEquals(t, n.Size, 1)
th.AssertEquals(t, n.ShareProto, "NFS")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:14,代码来源:request_test.go
示例17: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleGetExtensionsSuccessfully(t)
ext, err := extensions.Get(client.ServiceClient(), "agent").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, ext.Updated, "2013-02-03T10:00:00-00:00")
th.AssertEquals(t, ext.Name, "agent")
th.AssertEquals(t, ext.Namespace, "http://docs.openstack.org/ext/agent/api/v2.0")
th.AssertEquals(t, ext.Alias, "agent")
th.AssertEquals(t, ext.Description, "The agent management extension.")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:15,代码来源:delegate_test.go
示例18: TestHostRoute
func TestHostRoute(t *testing.T) {
sejson := []byte(`
{"subnet": {
"name": "test-subnet",
"enable_dhcp": false,
"network_id": "3e66c41e-cbbd-4019-9aab-740b7e4150a0",
"tenant_id": "f86e123198cf42d19c8854c5f80c2f06",
"dns_nameservers": [],
"gateway_ip": "172.16.0.1",
"ipv6_ra_mode": null,
"allocation_pools": [
{
"start": "172.16.0.2",
"end": "172.16.255.254"
}
],
"host_routes": [
{
"destination": "172.20.1.0/24",
"nexthop": "172.16.0.2"
}
],
"ip_version": 4,
"ipv6_address_mode": null,
"cidr": "172.16.0.0/16",
"id": "6dcaa873-7115-41af-9ef5-915f73636e43",
"subnetpool_id": null
}}
`)
var dejson interface{}
err := json.Unmarshal(sejson, &dejson)
if err != nil {
t.Fatalf("%s", err)
}
resp := gophercloud.Result{Body: dejson}
var subnetWrapper struct {
Subnet subnets.Subnet `json:"subnet"`
}
err = resp.ExtractInto(&subnetWrapper)
if err != nil {
t.Fatalf("%s", err)
}
route := subnetWrapper.Subnet.HostRoutes[0]
th.AssertEquals(t, route.NextHop, "172.16.0.2")
th.AssertEquals(t, route.DestinationCIDR, "172.20.1.0/24")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:48,代码来源:results_test.go
示例19: TestMemberUpdateSuccessfully
func TestMemberUpdateSuccessfully(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
counter := HandleImageMemberUpdate(t)
im, err := members.Update(fakeclient.ServiceClient(), "da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
"8989447062e04a818baf9e073fd04fa7",
members.UpdateOpts{
Status: "accepted",
}).Extract()
th.AssertEquals(t, 1, counter.Counter)
th.AssertNoErr(t, err)
createdAt, err := time.Parse(time.RFC3339, "2013-11-26T07:21:21Z")
th.AssertNoErr(t, err)
updatedAt, err := time.Parse(time.RFC3339, "2013-11-26T07:21:21Z")
th.AssertNoErr(t, err)
th.AssertDeepEquals(t, members.Member{
CreatedAt: createdAt,
ImageID: "da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
MemberID: "8989447062e04a818baf9e073fd04fa7",
Schema: "/v2/schemas/member",
Status: "accepted",
UpdatedAt: updatedAt,
}, *im)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例20: TestListGlobalParams
func TestListGlobalParams(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
fixture.SetupHandler(t, globalParamListURL, "GET", "", ListParamsJSON, 200)
pages := 0
err := configurations.ListGlobalParams(fake.ServiceClient(), versionID).EachPage(func(page pagination.Page) (bool, error) {
pages++
actual, err := configurations.ExtractParams(page)
if err != nil {
return false, err
}
expected := []configurations.Param{
{Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer"},
{Max: 4294967296, Min: 0, Name: "key_buffer_size", RestartRequired: false, Type: "integer"},
{Max: 65535, Min: 2, Name: "connect_timeout", RestartRequired: false, Type: "integer"},
{Max: 4294967296, Min: 0, Name: "join_buffer_size", RestartRequired: false, Type: "integer"},
}
th.AssertDeepEquals(t, actual, expected)
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, pages)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
注:本文中的github.com/gophercloud/gophercloud/testhelper.AssertEquals函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论