File: links_test.go

package info (click to toggle)
golang-github-centurylinkcloud-clc-sdk 0.0.2%2Bgit20161004.f62483c-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 228 kB
  • sloc: sh: 18; makefile: 13
file content (28 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package api_test

import (
	"testing"

	"github.com/CenturyLinkCloud/clc-sdk/api"
	"github.com/stretchr/testify/assert"
)

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")
}

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, "")
}