36 lines
929 B
Go
36 lines
929 B
Go
package gophercloud
|
|
|
|
import (
|
|
"testing"
|
|
|
|
th "github.com/rackspace/gophercloud/testhelper"
|
|
)
|
|
|
|
func TestAuthenticatedHeaders(t *testing.T) {
|
|
p := &ProviderClient{
|
|
TokenID: "1234",
|
|
}
|
|
expected := map[string]string{"X-Auth-Token": "1234"}
|
|
actual := p.AuthenticatedHeaders()
|
|
th.CheckDeepEquals(t, expected, actual)
|
|
}
|
|
|
|
func TestUserAgent(t *testing.T) {
|
|
p := &ProviderClient{}
|
|
|
|
p.UserAgent.Prepend("custom-user-agent/2.4.0")
|
|
expected := "custom-user-agent/2.4.0 gophercloud/1.0.0"
|
|
actual := p.UserAgent.Join()
|
|
th.CheckEquals(t, expected, actual)
|
|
|
|
p.UserAgent.Prepend("another-custom-user-agent/0.3.0", "a-third-ua/5.9.0")
|
|
expected = "another-custom-user-agent/0.3.0 a-third-ua/5.9.0 custom-user-agent/2.4.0 gophercloud/1.0.0"
|
|
actual = p.UserAgent.Join()
|
|
th.CheckEquals(t, expected, actual)
|
|
|
|
p.UserAgent = UserAgent{}
|
|
expected = "gophercloud/1.0.0"
|
|
actual = p.UserAgent.Join()
|
|
th.CheckEquals(t, expected, actual)
|
|
}
|