/* * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. */ package govcd import ( . "gopkg.in/check.v1" ) func (s *S) Test_FindCatalogItem(c *C) { // Get the Org populated testServer.Response(200, nil, orgExample) org, err := s.vdc.GetVDCOrg() _ = testServer.WaitRequest() testServer.Flush() c.Assert(err, IsNil) // Populate Catalog testServer.Response(200, nil, catalogExample) cat, err := org.FindCatalog("Public Catalog") _ = testServer.WaitRequest() testServer.Flush() // Find Catalog Item testServer.Response(200, nil, catalogitemExample) catitem, err := cat.FindCatalogItem("CentOS64-32bit") _ = testServer.WaitRequest() testServer.Flush() c.Assert(err, IsNil) c.Assert(catitem.CatalogItem.HREF, Equals, "http://localhost:4444/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae") c.Assert(catitem.CatalogItem.Description, Equals, "id: cts-6.4-32bit") // Test non-existant catalog item catitem, err = cat.FindCatalogItem("INVALID") c.Assert(err, NotNil) } var catalogExample = ` vCHS service catalog true 2013-10-15T01:14:22.370Z 60 `