本文整理匯總了Golang中git/openstack/org/stackforge/golang-client/git/testUtil.IsNil函數的典型用法代碼示例。如果您正苦於以下問題:Golang IsNil函數的具體用法?Golang IsNil怎麽用?Golang IsNil使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了IsNil函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestServiceURLComputeV3Returns
func TestServiceURLComputeV3Returns(t *testing.T) {
sc := []service{createService("computev3", "nova", testEndpoints...)}
url, err := getComputeServiceURL("t", nil, sc, "compute", "region1", "3")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://endpoint1", url)
}
示例2: TestCreateServer
func TestCreateServer(t *testing.T) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, createServerJSONPayload, "servers",
`{"server":{"name":"my_server","imageRef":"8c3cd338-1282-4fbb-bbaf-2256ff97c7b7","key_name":"my_key_name","flavorRef":"101","maxcount":1,"mincount":1,"user_data":"my_user_data","availability_zone":"az1","networks":[{"uuid":"1111d337-0282-4fbb-bbaf-2256ff97c7b7","port":"881"}],"security_groups":[{"name":"my_security_group_123"}]}}`)
defer apiServer.Close()
serverService := CreateComputeService(apiServer.URL)
az := "az1"
userData := "my_user_data"
maxMinCount := int32(1)
var serverCreationParameters = ServerCreationParameters{
Name: "my_server",
ImageRef: "8c3cd338-1282-4fbb-bbaf-2256ff97c7b7",
KeyPairName: "my_key_name",
FlavorRef: "101",
MaxCount: &maxMinCount,
MinCount: &maxMinCount,
AvailabilityZone: &az,
UserData: &userData,
Networks: []ServerNetworkParameters{ServerNetworkParameters{UUID: "1111d337-0282-4fbb-bbaf-2256ff97c7b7", Port: "881"}},
SecurityGroups: []SecurityGroup{SecurityGroup{Name: "my_security_group_123"}}}
result, err := serverService.CreateServer(serverCreationParameters)
testUtil.IsNil(t, err)
testUtil.Equals(t, createServerResponse, result)
}
示例3: TestDelete
func TestDelete(t *testing.T) {
var apiServer = testUtil.CreateDeleteTestRequestServer(t, token, "/other")
defer apiServer.Close()
err := util.Delete(apiServer.URL+"/other", token, *http.DefaultClient)
testUtil.IsNil(t, err)
}
示例4: TestServiceURLNetworkV3Returns
func TestServiceURLNetworkV3Returns(t *testing.T) {
sc := []service{createService("network", "neutron", testEndpoints...)}
url, err := getAppendVersionServiceURL("t", nil, sc, "network", "region2", "3")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://endpoint2/v3", url)
}
示例5: TestFindEndpointVersionNoValueFoundNoErrorShouldOccur
func TestFindEndpointVersionNoValueFoundNoErrorShouldOccur(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, hpHelionImageVersionPayload, "")
defer apiServer.Close()
url, err := FindEndpointVersion(apiServer.URL, tokn, nil, "v2.0")
testUtil.IsNil(t, err)
testUtil.Equals(t, "", url)
}
示例6: TestDefaultServiceURLFoundInCatalogFoundInVersionList
func TestDefaultServiceURLFoundInCatalogFoundInVersionList(t *testing.T) {
apiServer := testVersionList(t)
defer apiServer.Close()
sc := []service{createService("image", "glance", endpoint{Region: "region1", PublicURL: apiServer.URL + "/publicurl", VersionList: apiServer.URL + "/versionlist"})}
url, err := defaultGetVersionURLFilterByVersion("t", nil, sc, "image", "region1", "1")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://region-b.geo-1.image.hpcloudsvc.com/v1/", url)
}
示例7: TestFindEndpointVersionValid
func TestFindEndpointVersionValid(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, hpHelionImageVersionPayload, "")
defer apiServer.Close()
url, err := FindEndpointVersion(apiServer.URL, tokn, nil, "v1.0")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://region-a.geo-1.images.hpcloudsvc.com/v1/", url)
}
示例8: TestCreateUser
func TestCreateUser(t *testing.T) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, "", "/instances/InstanceID/users",
`{"users":[{"name":"username","password":"32thbw3"}]}`)
defer apiServer.Close()
service := CreateDatabaseService(apiServer.URL)
err := service.CreateUser("InstanceID", UserParameter{Name: "username", Password: "32thbw3"})
testUtil.IsNil(t, err)
}
示例9: TestGetVolumeType
func TestGetVolumeType(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyStatusAndURL(t, tokn, 200, sampleVolumeTypeJson, "/types/id")
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
volume, err := service.VolumeType("id")
testUtil.IsNil(t, err)
testUtil.Equals(t, volumeTypeSample, volume)
}
示例10: TestDeleteVolumeType
func TestDeleteVolumeType(t *testing.T) {
name := "id"
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "types/"+name)
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
err := service.DeleteVolumeType(name)
testUtil.IsNil(t, err)
}
示例11: TestDeleteUser
func TestDeleteUser(t *testing.T) {
name := "user"
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "/instanceID/users/"+name)
defer apiServer.Close()
service := CreateDatabaseService(apiServer.URL)
err := service.DeleteUser("instanceID", name)
testUtil.IsNil(t, err)
}
示例12: TestCreateDatabase
func TestCreateDatabase(t *testing.T) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, "", "/instances/InstanceID/databases",
`{"databases":[{"character_set":"utf32","collate":"latin","name":"username"}]}`)
defer apiServer.Close()
service := CreateDatabaseService(apiServer.URL)
err := service.CreateDatabases("InstanceID", CreateDatabaseParameters{Name: "username", CharacterSet: "utf32", Collate: "latin"})
testUtil.IsNil(t, err)
}
示例13: TestGetSecurityGroup
func TestGetSecurityGroup(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, sampleSecurityGroupJSONResponse, "/os-security-groups/w9236264")
defer apiServer.Close()
service := CreateComputeService(apiServer.URL)
sg, err := service.SecurityGroup("w9236264")
testUtil.IsNil(t, err)
testUtil.Equals(t, sampleSecurityGroup, sg)
}
示例14: TestDeleteSecurityGroupRule
func TestDeleteSecurityGroupRule(t *testing.T) {
name := "securitygrouprule"
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "/os-security-group-rules/"+name)
defer apiServer.Close()
service := CreateComputeService(apiServer.URL)
err := service.DeleteSecurityGroupRule(name)
testUtil.IsNil(t, err)
}
示例15: TestGetVolumeTypes
func TestGetVolumeTypes(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyStatusAndURL(t, tokn, 200, sampleVolumeTypesJson, "/types")
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
volumes, err := service.VolumeTypes()
testUtil.IsNil(t, err)
testUtil.Assert(t, len(volumes) == 1, "Expected 1 volume")
testUtil.Equals(t, volumeTypeSample, volumes[0])
}