github.com/hashicorp/packer@v1.14.3/provisioner/powershell/execution_policy_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package powershell
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestExecutionPolicy_Decode(t *testing.T) {
    11  	config := map[string]interface{}{
    12  		"inline":           []interface{}{"foo", "bar"},
    13  		"execution_policy": "allsigned",
    14  	}
    15  	p := new(Provisioner)
    16  	err := p.Prepare(config)
    17  	if err != nil {
    18  		t.Fatal(err)
    19  	}
    20  
    21  	if p.config.ExecutionPolicy != ExecutionPolicyAllsigned {
    22  		t.Fatalf("Expected AllSigned execution policy; got: %s", p.config.ExecutionPolicy)
    23  	}
    24  }