當前位置: 首頁>>代碼示例>>Golang>>正文


Golang testUtil.IsNil函數代碼示例

本文整理匯總了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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:7,代碼來源:authServiceCatalogResolvingFunctions_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:26,代碼來源:server_test.go

示例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)
}
開發者ID:christoffetzer,項目名稱:golang-client,代碼行數:7,代碼來源:util_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:7,代碼來源:authServiceCatalogResolvingFunctions_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:8,代碼來源:serviceversionlist_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:8,代碼來源:authServiceCatalogResolvingFunctions_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:8,代碼來源:serviceversionlist_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:user_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:volumetype_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:volumetype_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:user_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:database_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:securitygroup_test.go

示例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)
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:9,代碼來源:securitygroup_test.go

示例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])
}
開發者ID:alvaropeon,項目名稱:hpcloud-kubesetup,代碼行數:10,代碼來源:volumetype_test.go


注:本文中的git/openstack/org/stackforge/golang-client/git/testUtil.IsNil函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。