Jon Perritt | d4106ec | 2015-01-22 08:51:06 -0700 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame^] | 8 | "github.com/gophercloud/gophercloud" |
| 9 | osServiceAssets "github.com/gophercloud/gophercloud/openstack/cdn/v1/serviceassets" |
| 10 | "github.com/gophercloud/gophercloud/rackspace/cdn/v1/serviceassets" |
| 11 | th "github.com/gophercloud/gophercloud/testhelper" |
Jon Perritt | d4106ec | 2015-01-22 08:51:06 -0700 | [diff] [blame] | 12 | ) |
| 13 | |
| 14 | func TestServiceAsset(t *testing.T) { |
| 15 | client := newClient(t) |
| 16 | |
| 17 | t.Log("Creating Service") |
Jon Perritt | 1bda9c1 | 2015-01-29 12:16:08 -0700 | [diff] [blame] | 18 | loc := testServiceCreate(t, client, "test-site-2") |
Jon Perritt | d4106ec | 2015-01-22 08:51:06 -0700 | [diff] [blame] | 19 | t.Logf("Created service at location: %s", loc) |
| 20 | |
| 21 | t.Log("Deleting Service Assets") |
| 22 | testServiceAssetDelete(t, client, loc) |
| 23 | } |
| 24 | |
| 25 | func testServiceAssetDelete(t *testing.T, client *gophercloud.ServiceClient, url string) { |
| 26 | deleteOpts := osServiceAssets.DeleteOpts{ |
| 27 | All: true, |
| 28 | } |
| 29 | err := serviceassets.Delete(client, url, deleteOpts).ExtractErr() |
| 30 | th.AssertNoErr(t, err) |
| 31 | t.Log("Successfully deleted all Service Assets") |
| 32 | } |