本文整理汇总了Golang中github.com/gophercloud/gophercloud/testhelper.AssertDeepEquals函数的典型用法代码示例。如果您正苦于以下问题:Golang AssertDeepEquals函数的具体用法?Golang AssertDeepEquals怎么用?Golang AssertDeepEquals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertDeepEquals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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
示例2: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleGet(t)
n, err := portsbinding.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.DeviceID, "5e3898d7-11be-483e-9732-b2f5eccd2b2e")
th.AssertEquals(t, n.HostID, "devstack")
th.AssertEquals(t, n.VNICType, "normal")
th.AssertEquals(t, n.VIFType, "ovs")
th.AssertDeepEquals(t, n.VIFDetails, map[string]interface{}{"port_filter": true, "ovs_hybrid_plug": true})
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:28,代码来源:requests_test.go
示例3: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/v2.0/subnets/54d6f61d-db07-451c-9ab3-b9609b6b6f0b", 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, `
{
"subnet": {
"name": "my_subnet",
"enable_dhcp": true,
"network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
"dns_nameservers": [],
"allocation_pools": [
{
"start": "192.0.0.2",
"end": "192.255.255.254"
}
],
"host_routes": [],
"ip_version": 4,
"gateway_ip": "192.0.0.1",
"cidr": "192.0.0.0/8",
"id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
}
}
`)
})
s, err := subnets.Get(fake.ServiceClient(), "54d6f61d-db07-451c-9ab3-b9609b6b6f0b").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, s.Name, "my_subnet")
th.AssertEquals(t, s.EnableDHCP, true)
th.AssertEquals(t, s.NetworkID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
th.AssertEquals(t, s.TenantID, "4fd44f30292945e481c7b8a0c8908869")
th.AssertDeepEquals(t, s.DNSNameservers, []string{})
th.AssertDeepEquals(t, s.AllocationPools, []subnets.AllocationPool{
{
Start: "192.0.0.2",
End: "192.255.255.254",
},
})
th.AssertDeepEquals(t, s.HostRoutes, []subnets.HostRoute{})
th.AssertEquals(t, s.IPVersion, 4)
th.AssertEquals(t, s.GatewayIP, "192.0.0.1")
th.AssertEquals(t, s.CIDR, "192.0.0.0/8")
th.AssertEquals(t, s.ID, "54d6f61d-db07-451c-9ab3-b9609b6b6f0b")
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:55,代码来源:requests_test.go
示例4: 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
示例5: TestListInstances
func TestListInstances(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
fixture.SetupHandler(t, resURL+"/instances", "GET", "", ListInstancesJSON, 200)
expectedInstance := instances.Instance{
ID: "d4603f69-ec7e-4e9b-803f-600b9205576f",
Name: "json_rack_instance",
}
pages := 0
err := configurations.ListInstances(fake.ServiceClient(), configID).EachPage(func(page pagination.Page) (bool, error) {
pages++
actual, err := instances.ExtractInstances(page)
if err != nil {
return false, err
}
th.AssertDeepEquals(t, actual, []instances.Instance{expectedInstance})
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, pages)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:27,代码来源:requests_test.go
示例6: TestListVersions
func TestListVersions(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
MockListResponse(t)
count := 0
apiversions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := apiversions.ExtractAPIVersions(page)
th.AssertNoErr(t, err)
expected := []apiversions.APIVersion{
{
ID: "v1.0",
Status: "CURRENT",
Updated: "2012-01-04T11:33:21Z",
},
{
ID: "v2.0",
Status: "CURRENT",
Updated: "2012-11-21T11:33:21Z",
},
}
th.AssertDeepEquals(t, expected, actual)
return true, nil
})
th.AssertEquals(t, 1, count)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:33,代码来源:requests_test.go
示例7: TestAddRuleICMPZero
func TestAddRuleICMPZero(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockAddRuleResponseICMPZero(t)
opts := secgroups.CreateRuleOpts{
ParentGroupID: groupID,
FromPort: 0,
ToPort: 0,
IPProtocol: "ICMP",
CIDR: "0.0.0.0/0",
}
rule, err := secgroups.CreateRule(client.ServiceClient(), opts).Extract()
th.AssertNoErr(t, err)
expected := &secgroups.Rule{
FromPort: 0,
ToPort: 0,
Group: secgroups.Group{},
IPProtocol: "ICMP",
ParentGroupID: groupID,
IPRange: secgroups.IPRange{CIDR: "0.0.0.0/0"},
ID: ruleID,
}
th.AssertDeepEquals(t, expected, rule)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例8: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockGetGroupsResponse(t, groupID)
group, err := secgroups.Get(client.ServiceClient(), groupID).Extract()
th.AssertNoErr(t, err)
expected := &secgroups.SecurityGroup{
ID: groupID,
Description: "default",
Name: "default",
TenantID: "openstack",
Rules: []secgroups.Rule{
{
FromPort: 80,
ToPort: 85,
IPProtocol: "TCP",
IPRange: secgroups.IPRange{CIDR: "0.0.0.0"},
Group: secgroups.Group{TenantID: "openstack", Name: "default"},
ParentGroupID: groupID,
ID: ruleID,
},
},
}
th.AssertDeepEquals(t, expected, group)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例9: TestGet
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleGetCDNFlavorSuccessfully(t)
expected := &flavors.Flavor{
ID: "asia",
Providers: []flavors.Provider{
{
Provider: "ChinaCache",
Links: []gophercloud.Link{
gophercloud.Link{
Href: "http://www.chinacache.com",
Rel: "provider_url",
},
},
},
},
Links: []gophercloud.Link{
gophercloud.Link{
Href: "https://www.poppycdn.io/v1.0/flavors/asia",
Rel: "self",
},
},
}
actual, err := flavors.Get(fake.ServiceClient(), "asia").Extract()
th.AssertNoErr(t, err)
th.AssertDeepEquals(t, expected, actual)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:31,代码来源:requests_test.go
示例10: TestListVersions
func TestListVersions(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/", 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, `
{
"versions": [
{
"status": "CURRENT",
"id": "v1.0",
"links": [
{
"href": "http://23.253.228.211:8000/v1",
"rel": "self"
}
]
}
]
}`)
})
count := 0
apiversions.ListVersions(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := apiversions.ExtractAPIVersions(page)
if err != nil {
t.Errorf("Failed to extract API versions: %v", err)
return false, err
}
expected := []apiversions.APIVersion{
{
Status: "CURRENT",
ID: "v1.0",
Links: []gophercloud.Link{
gophercloud.Link{
Href: "http://23.253.228.211:8000/v1",
Rel: "self",
},
},
},
}
th.AssertDeepEquals(t, expected, actual)
return true, nil
})
if count != 1 {
t.Errorf("Expected 1 page, got %d", count)
}
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:60,代码来源:requests_test.go
示例11: TestPreviewStack
func TestPreviewStack(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandlePreviewSuccessfully(t, GetOutput)
template := new(stacks.Template)
template.Bin = []byte(`
{
"heat_template_version": "2013-05-23",
"description": "Simple template to test heat commands",
"parameters": {
"flavor": {
"default": "m1.tiny",
"type": "string"
}
}
}`)
previewOpts := stacks.PreviewOpts{
Name: "stackcreated",
Timeout: 60,
TemplateOpts: template,
DisableRollback: gophercloud.Disabled,
}
actual, err := stacks.Preview(fake.ServiceClient(), previewOpts).Extract()
th.AssertNoErr(t, err)
expected := PreviewExpected
th.AssertDeepEquals(t, expected, actual)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例12: 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
示例13: TestGetSuccessful
func TestGetSuccessful(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/services/12345", 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")
fmt.Fprintf(w, `
{
"service": {
"description": "Service One",
"id": "12345",
"name": "service-one",
"type": "identity"
}
}
`)
})
actual, err := services.Get(client.ServiceClient(), "12345").Extract()
th.AssertNoErr(t, err)
expected := &services.Service{
ID: "12345",
Description: "Service One",
Name: "service-one",
Type: "identity",
}
th.AssertDeepEquals(t, expected, actual)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:33,代码来源:requests_test.go
示例14: TestCreateUser
func TestCreateUser(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockCreateUserResponse(t)
opts := users.CreateOpts{
Name: "new_user",
TenantID: "12345",
Enabled: gophercloud.Disabled,
Email: "[email protected]",
}
user, err := users.Create(client.ServiceClient(), opts).Extract()
th.AssertNoErr(t, err)
expected := &users.User{
Name: "new_user",
ID: "c39e3de9be2d4c779f1dfd6abacc176d",
Email: "[email protected]",
Enabled: false,
TenantID: "12345",
}
th.AssertDeepEquals(t, expected, user)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:27,代码来源:requests_test.go
示例15: TestCreateMemberSuccessfully
func TestCreateMemberSuccessfully(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleCreateImageMemberSuccessfully(t)
im, err := members.Create(fakeclient.ServiceClient(), "da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
"8989447062e04a818baf9e073fd04fa7").Extract()
th.AssertNoErr(t, err)
createdAt, err := time.Parse(time.RFC3339, createdAtString)
th.AssertNoErr(t, err)
updatedAt, err := time.Parse(time.RFC3339, updatedAtString)
th.AssertNoErr(t, err)
th.AssertDeepEquals(t, members.Member{
CreatedAt: createdAt,
ImageID: "da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
MemberID: "8989447062e04a818baf9e073fd04fa7",
Schema: "/v2/schemas/member",
Status: "pending",
UpdatedAt: updatedAt,
}, *im)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:25,代码来源:requests_test.go
示例16: TestListFlavors
func TestListFlavors(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleList(t)
pages := 0
err := flavors.List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
pages++
actual, err := flavors.ExtractFlavors(page)
if err != nil {
return false, err
}
expected := []flavors.Flavor{
{
ID: 1,
Name: "m1.tiny",
RAM: 512,
Links: []gophercloud.Link{
{Href: "https://openstack.example.com/v1.0/1234/flavors/1", Rel: "self"},
{Href: "https://openstack.example.com/flavors/1", Rel: "bookmark"},
},
},
{
ID: 2,
Name: "m1.small",
RAM: 1024,
Links: []gophercloud.Link{
{Href: "https://openstack.example.com/v1.0/1234/flavors/2", Rel: "self"},
{Href: "https://openstack.example.com/flavors/2", Rel: "bookmark"},
},
},
{
ID: 3,
Name: "m1.medium",
RAM: 2048,
Links: []gophercloud.Link{
{Href: "https://openstack.example.com/v1.0/1234/flavors/3", Rel: "self"},
{Href: "https://openstack.example.com/flavors/3", Rel: "bookmark"},
},
},
{
ID: 4,
Name: "m1.large",
RAM: 4096,
Links: []gophercloud.Link{
{Href: "https://openstack.example.com/v1.0/1234/flavors/4", Rel: "self"},
{Href: "https://openstack.example.com/flavors/4", Rel: "bookmark"},
},
},
}
th.AssertDeepEquals(t, expected, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.AssertEquals(t, 1, pages)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:60,代码来源:requests_test.go
示例17: TestShowMemberDetails
func TestShowMemberDetails(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleImageMemberDetails(t)
md, err := members.Get(fakeclient.ServiceClient(),
"da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
"8989447062e04a818baf9e073fd04fa7").Extract()
th.AssertNoErr(t, err)
if md == nil {
t.Errorf("Expected non-nil value for md")
}
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: "pending",
UpdatedAt: updatedAt,
}, *md)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
示例18: 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
示例19: TestList
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleListExtensionsSuccessfully(t)
count := 0
extensions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := extensions.ExtractExtensions(page)
th.AssertNoErr(t, err)
expected := []common.Extension{
common.Extension{
Updated: "2013-01-20T00:00:00-00:00",
Name: "Neutron Service Type Management",
Links: []interface{}{},
Namespace: "http://docs.openstack.org/ext/neutron/service-type/api/v1.0",
Alias: "service-type",
Description: "API for retrieving service providers for Neutron advanced services",
},
}
th.AssertDeepEquals(t, expected, actual)
return true, nil
})
th.CheckEquals(t, 1, count)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:28,代码来源:delegate_test.go
示例20: TestCreate
func TestCreate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleCreate(t)
opts := instances.CreateOpts{
Name: "json_rack_instance",
FlavorRef: "1",
Databases: db.BatchCreateOpts{
{CharSet: "utf8", Collate: "utf8_general_ci", Name: "sampledb"},
{Name: "nextround"},
},
Users: users.BatchCreateOpts{
{
Name: "demouser",
Password: "demopassword",
Databases: db.BatchCreateOpts{
{Name: "sampledb"},
},
},
},
Size: 2,
}
instance, err := instances.Create(fake.ServiceClient(), opts).Extract()
th.AssertNoErr(t, err)
th.AssertDeepEquals(t, &expectedInstance, instance)
}
开发者ID:jrperritt,项目名称:gophercloud-1,代码行数:29,代码来源:requests_test.go
注:本文中的github.com/gophercloud/gophercloud/testhelper.AssertDeepEquals函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论