blob: 1cdb210de04aa985d31be71fc229f98a7f991b23 [file] [log] [blame]
Jon Perritt703bfc02014-10-08 14:35:00 -05001package servers
2
3import (
4 "testing"
5
6 "github.com/rackspace/gophercloud"
7 th "github.com/rackspace/gophercloud/testhelper"
8)
9
10const endpoint = "http://localhost:57909"
11
12func endpointClient() *gophercloud.ServiceClient {
13 return &gophercloud.ServiceClient{Endpoint: endpoint}
14}
15
16func TestCreateURL(t *testing.T) {
17 actual := createURL(endpointClient())
18 expected := endpoint + "servers"
19 th.CheckEquals(t, expected, actual)
20}
21
22func TestListURL(t *testing.T) {
23 actual := listURL(endpointClient())
24 expected := endpoint + "servers"
25 th.CheckEquals(t, expected, actual)
26}
27
28func TestListDetailURL(t *testing.T) {
29 actual := listDetailURL(endpointClient())
30 expected := endpoint + "servers/detail"
31 th.CheckEquals(t, expected, actual)
32}
33
34func TestDeleteURL(t *testing.T) {
35 actual := deleteURL(endpointClient(), "foo")
36 expected := endpoint + "servers/foo"
37 th.CheckEquals(t, expected, actual)
38}
39
40func TestGetURL(t *testing.T) {
41 actual := getURL(endpointClient(), "foo")
42 expected := endpoint + "servers/foo"
43 th.CheckEquals(t, expected, actual)
44}
45
46func TestUpdateURL(t *testing.T) {
47 actual := updateURL(endpointClient(), "foo")
48 expected := endpoint + "servers/foo"
49 th.CheckEquals(t, expected, actual)
50}
51
52func TestActionURL(t *testing.T) {
53 actual := actionURL(endpointClient(), "foo")
54 expected := endpoint + "servers/foo/action"
55 th.CheckEquals(t, expected, actual)
56}
Jon Perrittcc77da62014-11-16 13:14:21 -070057
58func TestMetadataURL(t *testing.T) {
59 actual := metadataURL(endpointClient(), "foo", "bar")
60 expected := endpoint + "servers/foo/metadata/bar"
61 th.CheckEquals(t, expected, actual)
62}
63
64func TestMetadatasURL(t *testing.T) {
65 actual := metadatasURL(endpointClient(), "foo")
66 expected := endpoint + "servers/foo/metadata"
67 th.CheckEquals(t, expected, actual)
68}