| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package govcd |
| 6 |
|
| 7 |
import ( |
| 8 |
. "gopkg.in/check.v1" |
| 9 |
) |
| 10 |
|
| 11 |
func (s *S) Test_GetVAppTemplate(c *C) { |
| 12 |
|
| 13 |
|
| 14 |
testServer.Response(200, nil, orgExample) |
| 15 |
org, err := s.vdc.GetVDCOrg() |
| 16 |
_ = testServer.WaitRequest() |
| 17 |
testServer.Flush() |
| 18 |
c.Assert(err, IsNil) |
| 19 |
|
| 20 |
|
| 21 |
testServer.Response(200, nil, catalogExample) |
| 22 |
cat, err := org.FindCatalog("Public Catalog") |
| 23 |
_ = testServer.WaitRequest() |
| 24 |
testServer.Flush() |
| 25 |
|
| 26 |
|
| 27 |
testServer.Response(200, nil, catalogitemExample) |
| 28 |
catitem, err := cat.FindCatalogItem("CentOS64-32bit") |
| 29 |
_ = testServer.WaitRequest() |
| 30 |
testServer.Flush() |
| 31 |
|
| 32 |
|
| 33 |
testServer.Response(200, nil, vapptemplateExample) |
| 34 |
vapptemplate, err := catitem.GetVAppTemplate() |
| 35 |
_ = testServer.WaitRequest() |
| 36 |
testServer.Flush() |
| 37 |
|
| 38 |
c.Assert(err, IsNil) |
| 39 |
c.Assert(vapptemplate.VAppTemplate.HREF, Equals, "http://localhost:4444/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5") |
| 40 |
c.Assert(vapptemplate.VAppTemplate.Name, Equals, "CentOS64-32bit") |
| 41 |
c.Assert(vapptemplate.VAppTemplate.Description, Equals, "id: cts-6.4-32bit") |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
var catalogitemExample = ` |
| 46 |
<?xml version="1.0" ?> |
| 47 |
<CatalogItem href="http://localhost:4444/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae" id="urn:vcloud:catalogitem:1176e485-8858-4e15-94e5-ae4face605ae" name="CentOS64-32bit" size="0" type="application/vnd.vmware.vcloud.catalogItem+xml" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.6.32.3/api/v1.5/schema/master.xsd"> |
| 48 |
<Link href="http://localhost:4444/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854" rel="up" type="application/vnd.vmware.vcloud.catalog+xml"/> |
| 49 |
<Link href="http://localhost:4444/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae/metadata" rel="down" type="application/vnd.vmware.vcloud.metadata+xml"/> |
| 50 |
<Description>id: cts-6.4-32bit</Description> |
| 51 |
<Entity href="http://localhost:4444/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5" name="CentOS64-32bit" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/> |
| 52 |
<DateCreated>2014-06-04T21:06:43.750Z</DateCreated> |
| 53 |
<VersionNumber>4</VersionNumber> |
| 54 |
</CatalogItem> |
| 55 |
` |