Jon Perritt | f81e17a | 2014-09-15 01:29:41 -0500 | [diff] [blame] | 1 | package objects |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | "github.com/rackspace/gophercloud" |
| 6 | ) |
| 7 | |
| 8 | func TestContainerURL(t *testing.T) { |
| 9 | client := gophercloud.ServiceClient{ |
| 10 | Endpoint: "http://localhost:5000/v1/", |
| 11 | } |
| 12 | expected := "http://localhost:5000/v1/testContainer" |
| 13 | actual := containerURL(&client, "testContainer") |
| 14 | if actual != expected { |
| 15 | t.Errorf("Unexpected service URL generated: %s", actual) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | func TestObjectURL(t *testing.T) { |
| 20 | client := gophercloud.ServiceClient{ |
| 21 | Endpoint: "http://localhost:5000/v1/", |
| 22 | } |
| 23 | expected := "http://localhost:5000/v1/testContainer/testObject" |
| 24 | actual := objectURL(&client, "testContainer", "testObject") |
| 25 | if actual != expected { |
| 26 | t.Errorf("Unexpected service URL generated: %s", actual) |
| 27 | } |
| 28 | } |