forked from rackspace/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provider_client_test.go
35 lines (28 loc) · 929 Bytes
/
provider_client_test.go
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
29
30
31
32
33
34
35
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)
}