示例#1
0
func TestGetID_Success(t *testing.T) {
	assert := assert.New(t)

	links := api.Links{api.Link{Rel: "a", ID: "1"}}
	ok, id := links.GetID("a")

	assert.True(ok)
	assert.Equal(id, "1")
}
示例#2
0
func TestGetID_Failure(t *testing.T) {
	assert := assert.New(t)

	links := api.Links{api.Link{Rel: "a", ID: "1"}}
	ok, id := links.GetID("b")

	assert.False(ok)
	assert.Equal(id, "")
}