本文整理匯總了Golang中github.com/nowk/assert.TypeOf函數的典型用法代碼示例。如果您正苦於以下問題:Golang TypeOf函數的具體用法?Golang TypeOf怎麽用?Golang TypeOf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了TypeOf函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestRelationshipsRelationship
func TestRelationshipsRelationship(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/users\/\d+\/relationship\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 203}}`)
data, _ := api.Relationships.Relationship(12345)
assert.Equal(t, data.Meta.Code, 203)
assert.TypeOf(t, "*jsons.Relationship", data)
assert.TypeOf(t, "jsons.RelationshipData", data.Data)
}
示例2: TestRelationshipsFollows
func TestRelationshipsFollows(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/users\/\d+\/follows\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 200}}`)
data, _ := api.Relationships.Follows(123)
assert.Equal(t, data.Meta.Code, 200)
assert.TypeOf(t, "*jsons.Users", data)
assert.TypeOf(t, "[]jsons.UserData", data.Data)
}
示例3: TestRelationshipsSelfRequestedBy
func TestRelationshipsSelfRequestedBy(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/users\/self\/requested-by\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 202}}`)
data, _ := api.Relationships.SelfRequestedBy()
assert.Equal(t, data.Meta.Code, 202)
assert.TypeOf(t, "*jsons.Users", data)
assert.TypeOf(t, "[]jsons.UserData", data.Data)
}
示例4: TestRealTimeSubscriptions
func TestRealTimeSubscriptions(t *testing.T) {
api, mock := tNewRealTime(t, "my-clientid", "a-secret")
reg := regmc(`v1\/subscriptions\?client_id=[a-z-]+&client_secret=[a-z-]+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 202}}`)
data, _ := api.Subscriptions()
assert.Equal(t, data.Meta.Code, 202)
assert.TypeOf(t, "*jsons.Subscriptions", data)
assert.TypeOf(t, "[]jsons.SubscriptionData", data.Data)
}
示例5: TestMediaMedia
func TestMediaMedia(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/media\/\d+\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 200}}`)
data, _ := api.Media.Media(1234)
assert.Equal(t, 200, data.Meta.Code)
assert.TypeOf(t, "*jsons.Media", data)
assert.TypeOf(t, "jsons.MediaData", data.Data)
}
示例6: TestUsersUser
func TestUsersUser(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/users\/\d+\?access_token=`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 201}}`)
data, _ := api.Users.User(1234)
assert.Equal(t, data.Meta.Code, 201)
assert.TypeOf(t, "*jsons.User", data)
assert.TypeOf(t, "jsons.UserData", data.Data)
}
示例7: TestTagsName
func TestTagsName(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/tags\/\w+\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 200}}`)
data, _ := api.Tags.Name("Foo")
assert.Equal(t, data.Meta.Code, 200)
assert.TypeOf(t, "*jsons.Tag", data)
assert.TypeOf(t, "jsons.TagData", data.Data)
}
示例8: TestLocationsLocation
func TestLocationsLocation(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/locations\/\d+\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 200}}`)
data, _ := api.Locations.Location(12345)
assert.Equal(t, data.Meta.Code, 200)
assert.TypeOf(t, "*jsons.Location", data)
assert.TypeOf(t, "jsons.LocationData", data.Data)
}
示例9: TestLikesPost
func TestLikesPost(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/media\/\d+\/likes\?access_token=\w+$`)
mock.Expect("POST", reg).Respond(200, `{"meta": {"code": 201}}`)
data, _ := api.Likes.Post(12345)
assert.Equal(t, data.Meta.Code, 201)
assert.TypeOf(t, "*jsons.Like", data)
assert.TypeOf(t, "jsons.LikeData", data.Data)
}
示例10: TestCommentsComments
func TestCommentsComments(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/media\/\d+\/comments\?access_token=\w+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 200}}`)
data, _ := api.Comments.Comments(12345)
assert.Equal(t, data.Meta.Code, 200)
assert.TypeOf(t, "*jsons.Comments", data)
assert.TypeOf(t, "[]jsons.CommentData", data.Data)
}
示例11: TestCommentsDelete
func TestCommentsDelete(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/media\/\d+\/comments\/\d+\?access_token=\w+$`)
mock.Expect("DELETE", reg).Respond(200, `{"meta": {"code": 202}}`)
data, _ := api.Comments.Delete(12345, 67890)
assert.Equal(t, data.Meta.Code, 202)
assert.TypeOf(t, "*jsons.Comment", data)
assert.TypeOf(t, "jsons.CommentData", data.Data)
}
示例12: TestLocationsSearch
func TestLocationsSearch(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/locations\/search\?access_token=\w+&distance=\d+&lat=(\d+\.\d+)&lng=(\d+\.\d+)$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 202}}`)
data, _ := api.Locations.Search(40.7127, 74.0059, map[string]string{
"distance": "5000",
})
assert.Equal(t, data.Meta.Code, 202)
assert.TypeOf(t, "*jsons.Locations", data)
assert.TypeOf(t, "[]jsons.LocationData", data.Data)
}
示例13: TestLocationsMediaRecent
func TestLocationsMediaRecent(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/locations\/\d+\/media\/recent\?access_token=\w+&min_id=\d+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 201}}`)
data, _ := api.Locations.MediaRecent(12345, map[string]string{
"min_id": "67890",
})
assert.Equal(t, data.Meta.Code, 201)
assert.TypeOf(t, "*jsons.Locations", data)
assert.TypeOf(t, "[]jsons.LocationData", data.Data)
}
示例14: TestUsersSelfMediaLiked
func TestUsersSelfMediaLiked(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/users\/self\/media\/liked\?access_token=\w+&count=\d+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 204}}`)
data, _ := api.Users.SelfMediaLiked(map[string]string{
"count": "50",
})
assert.Equal(t, data.Meta.Code, 204)
assert.TypeOf(t, "*jsons.Medias", data)
assert.TypeOf(t, "[]jsons.MediaData", data.Data)
}
示例15: TestTagsMediaRecent
func TestTagsMediaRecent(t *testing.T) {
api, mock := tNewInstagram(t)
reg := regmc(`v1\/tags\/\w+\/media\/recent\?access_token=\w+&count=\d+$`)
mock.Expect("GET", reg).Respond(200, `{"meta": {"code": 201}}`)
data, _ := api.Tags.MediaRecent("Foo", map[string]string{
"count": "50",
})
assert.Equal(t, data.Meta.Code, 201)
assert.TypeOf(t, "*jsons.Medias", data)
assert.TypeOf(t, "[]jsons.MediaData", data.Data)
}