Should return an error with an invalid BuilderId

pull/8018/head
DanHam 7 years ago
parent 17d9a85895
commit 57308b0126
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E

@ -2,10 +2,12 @@ package vagrantcloud
import (
"bytes"
"context"
"fmt"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"github.com/hashicorp/packer/packer"
@ -137,6 +139,24 @@ func TestPostProcessor_Configure_Bad(t *testing.T) {
}
}
func TestPostProcessor_PostProcess_checkArtifactType(t *testing.T) {
artifact := &packer.MockArtifact{
BuilderIdValue: "invalid.builder",
}
config := testGoodConfig()
server := newSecureServer("foo", nil)
defer server.Close()
config["vagrant_cloud_url"] = server.URL
var p PostProcessor
p.Configure(config)
_, _, _, err := p.PostProcess(context.Background(), testUi(), artifact)
if !strings.Contains(err.Error(), "Unknown artifact type") {
t.Fatalf("Should error with message 'Unknown artifact type...' with BuilderId: %s", artifact.BuilderIdValue)
}
}
func testUi() *packer.BasicUi {
return &packer.BasicUi{
Reader: new(bytes.Buffer),

Loading…
Cancel
Save