blob: feacf7f69b5c7ece24d56e548bd2fbbb4e8cafae [file] [log] [blame]
Jon Perritte747a0f2014-09-29 19:54:55 -05001package snapshots
Jon Perritt82522ca2014-09-29 22:31:31 -05002
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
Jon Perritt6d5561b2014-10-01 21:42:15 -050016func TestCreateURL(t *testing.T) {
17 actual := createURL(endpointClient())
Jon Perritt82522ca2014-09-29 22:31:31 -050018 expected := endpoint + "snapshots"
19 th.AssertEquals(t, expected, actual)
20}
21
Jon Perritt6d5561b2014-10-01 21:42:15 -050022func TestDeleteURL(t *testing.T) {
23 actual := deleteURL(endpointClient(), "foo")
Jon Perritt82522ca2014-09-29 22:31:31 -050024 expected := endpoint + "snapshots/foo"
25 th.AssertEquals(t, expected, actual)
26}
Jon Perritt6d5561b2014-10-01 21:42:15 -050027
28func TestGetURL(t *testing.T) {
29 actual := getURL(endpointClient(), "foo")
30 expected := endpoint + "snapshots/foo"
31 th.AssertEquals(t, expected, actual)
32}
33
34func TestListURL(t *testing.T) {
35 actual := listURL(endpointClient())
36 expected := endpoint + "snapshots"
37 th.AssertEquals(t, expected, actual)
38}
39
40func TestMetadataURL(t *testing.T) {
41 actual := metadataURL(endpointClient(), "foo")
42 expected := endpoint + "snapshots/foo/metadata"
43 th.AssertEquals(t, expected, actual)
44}
45
Jon Perritte357e3d2014-10-03 01:53:57 -050046func TestUpdateMetadataURL(t *testing.T) {
47 actual := updateMetadataURL(endpointClient(), "foo")
Jon Perritt6d5561b2014-10-01 21:42:15 -050048 expected := endpoint + "snapshots/foo/metadata"
49 th.AssertEquals(t, expected, actual)
50}