Skip to content

Commit

Permalink
post-processor/vagrant-cloud: tests for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pearkes committed Jun 25, 2014
1 parent f384806 commit a0c1538
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions post-processor/vagrant-cloud/post-processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,35 @@ import (
"testing"
)

func testConfig() map[string]interface{} {
return map[string]interface{}{}
func testGoodConfig() 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
if err := p.Configure(testConfig()); err != nil {
if err := p.Configure(testGoodConfig()); err != nil {
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 {
Expand Down

0 comments on commit a0c1538

Please sign in to comment.