builder/digitalocean: fix unit tests

This commit is contained in:
Mitchell Hashimoto 2015-06-10 14:28:05 -07:00
parent 9a393a5601
commit 311c9eb5c2
1 changed files with 3 additions and 13 deletions

View File

@ -1,22 +1,15 @@
package digitalocean package digitalocean
import ( import (
"github.com/mitchellh/packer/packer"
"os"
"strconv" "strconv"
"testing" "testing"
)
func init() { "github.com/mitchellh/packer/packer"
// Clear out the credential env vars )
os.Setenv("DIGITALOCEAN_API_KEY", "")
os.Setenv("DIGITALOCEAN_CLIENT_ID", "")
}
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"client_id": "foo", "api_token": "bar",
"api_key": "bar",
} }
} }
@ -78,7 +71,6 @@ func TestBuilderPrepare_Region(t *testing.T) {
expected := "sfo1" expected := "sfo1"
// Test set // Test set
config["region_id"] = 0
config["region"] = expected config["region"] = expected
b = Builder{} b = Builder{}
warnings, err = b.Prepare(config) warnings, err = b.Prepare(config)
@ -114,7 +106,6 @@ func TestBuilderPrepare_Size(t *testing.T) {
expected := "1024mb" expected := "1024mb"
// Test set // Test set
config["size_id"] = 0
config["size"] = expected config["size"] = expected
b = Builder{} b = Builder{}
warnings, err = b.Prepare(config) warnings, err = b.Prepare(config)
@ -150,7 +141,6 @@ func TestBuilderPrepare_Image(t *testing.T) {
expected := "ubuntu-14-04-x64" expected := "ubuntu-14-04-x64"
// Test set // Test set
config["image_id"] = 0
config["image"] = expected config["image"] = expected
b = Builder{} b = Builder{}
warnings, err = b.Prepare(config) warnings, err = b.Prepare(config)