Commit a0c15382 authored by Jack Pearkes's avatar Jack Pearkes

post-processor/vagrant-cloud: tests for configuration

parent f3848068
...@@ -6,17 +6,35 @@ import ( ...@@ -6,17 +6,35 @@ import (
"testing" "testing"
) )
func testConfig() map[string]interface{} { func testGoodConfig() map[string]interface{} {
return map[string]interface{}{} return map[string]interface{}{
"access_token": "foo",
"version_description": "bar",
"box_tag": "hashicorp/precise64",
"version": "0.5",
}
}
func testBadConfig() map[string]interface{} {
return map[string]interface{}{
"access_token": "foo",
"box_tag": "baz",
"version_description": "bar",
}
} }
func testPP(t *testing.T) *PostProcessor { func TestPostProcessor_Configure_Good(t *testing.T) {
var p PostProcessor var p PostProcessor
if err := p.Configure(testConfig()); err != nil { if err := p.Configure(testGoodConfig()); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
}
return &p func TestPostProcessor_Configure_Bad(t *testing.T) {
var p PostProcessor
if err := p.Configure(testBadConfig()); err == nil {
t.Fatalf("should have err")
}
} }
func testUi() *packer.BasicUi { func testUi() *packer.BasicUi {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment