blob: d4d0f8f5ab13631ba506d38c95ee72d9da87ae8f [file] [log] [blame]
Jon Perrittf63c9092015-02-09 11:23:59 -07001package stacktemplates
2
3import (
4 "testing"
5
6 os "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates"
7 th "github.com/rackspace/gophercloud/testhelper"
8 fake "github.com/rackspace/gophercloud/testhelper/client"
9)
10
11func TestGetTemplate(t *testing.T) {
12 th.SetupHTTP()
13 defer th.TeardownHTTP()
14 os.HandleGetSuccessfully(t, os.GetOutput)
15
16 actual, err := Get(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c87").Extract()
17 th.AssertNoErr(t, err)
18
19 expected := os.GetExpected
Pratik Mallya827c03e2015-09-17 00:10:47 -050020 th.AssertDeepEquals(t, expected, string(actual))
Jon Perrittf63c9092015-02-09 11:23:59 -070021}
22
23func TestValidateTemplate(t *testing.T) {
24 th.SetupHTTP()
25 defer th.TeardownHTTP()
26 os.HandleValidateSuccessfully(t, os.ValidateOutput)
27
28 opts := os.ValidateOpts{
Pratik Mallya827c03e2015-09-17 00:10:47 -050029 Template: `{
30 "Description": "Simple template to test heat commands",
31 "Parameters": {
32 "flavor": {
33 "Default": "m1.tiny",
34 "Type": "String",
35 "NoEcho": "false",
36 "Description": "",
37 "Label": "flavor"
38 }
39 }
40 }`,
Jon Perrittf63c9092015-02-09 11:23:59 -070041 }
42 actual, err := Validate(fake.ServiceClient(), opts).Extract()
43 th.AssertNoErr(t, err)
44
45 expected := os.ValidateExpected
46 th.AssertDeepEquals(t, expected, actual)
47}