packer-cn/builder/triton/access_config_test.go
Jasper Siepkes 7606dd541b * Contains the SSH fix by @watters of #3840.
* Fixed minor lint error.
* Added documentation for this builder in `triton.html.md`.
* Added (and updated) the needed Joyent Triton Cloud API Go libraries
  to `vendor.json`.
2016-12-27 17:05:27 +01:00

44 lines
740 B
Go

package triton
import (
"testing"
)
func TestAccessConfig_Prepare(t *testing.T) {
ac := testAccessConfig(t)
errs := ac.Prepare(nil)
if errs != nil {
t.Fatal("should not error")
}
ac = testAccessConfig(t)
ac.Account = ""
errs = ac.Prepare(nil)
if errs == nil {
t.Fatal("should error")
}
ac = testAccessConfig(t)
ac.KeyID = ""
errs = ac.Prepare(nil)
if errs == nil {
t.Fatal("should error")
}
ac = testAccessConfig(t)
ac.KeyMaterial = ""
errs = ac.Prepare(nil)
if errs == nil {
t.Fatal("should error")
}
}
func testAccessConfig(t *testing.T) AccessConfig {
return AccessConfig{
Endpoint: "test-endpoint",
Account: "test-account",
KeyID: "test-id",
KeyMaterial: "test-private-key",
}
}