Ash Wilson | ae0ca65 | 2014-10-23 12:30:12 -0400 | [diff] [blame^] | 1 | package servers |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig" |
| 7 | th "github.com/rackspace/gophercloud/testhelper" |
| 8 | ) |
| 9 | |
| 10 | func TestCreateOpts(t *testing.T) { |
| 11 | opts := CreateOpts{ |
| 12 | Name: "createdserver", |
| 13 | ImageRef: "image-id", |
| 14 | FlavorRef: "flavor-id", |
| 15 | KeyPair: "mykey", |
| 16 | DiskConfig: diskconfig.Manual, |
| 17 | } |
| 18 | |
| 19 | expected := ` |
| 20 | { |
| 21 | "server": { |
| 22 | "name": "createdserver", |
| 23 | "imageRef": "image-id", |
| 24 | "flavorRef": "flavor-id", |
| 25 | "key_name": "mykey", |
| 26 | "OS-DCF:diskConfig": "MANUAL" |
| 27 | } |
| 28 | } |
| 29 | ` |
| 30 | th.CheckJSONEquals(t, expected, opts.ToServerCreateMap()) |
| 31 | } |