github.com/hashicorp/packer@v1.14.3/fix/fixer_pp_manifest_filename_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package fix
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestFixerManifestPPFilename_Impl(t *testing.T) {
    13  	var _ Fixer = new(FixerVagrantPPOverride)
    14  }
    15  
    16  func TestFixerManifestPPFilename_Fix(t *testing.T) {
    17  	var f FixerManifestFilename
    18  
    19  	input := map[string]interface{}{
    20  		"post-processors": []interface{}{
    21  			map[string]interface{}{
    22  				"type":     "manifest",
    23  				"filename": "foo",
    24  			},
    25  			[]interface{}{
    26  				map[string]interface{}{
    27  					"type":     "manifest",
    28  					"filename": "foo",
    29  				},
    30  			},
    31  		},
    32  	}
    33  
    34  	expected := map[string]interface{}{
    35  		"post-processors": []interface{}{
    36  			map[string]interface{}{
    37  				"type":   "manifest",
    38  				"output": "foo",
    39  			},
    40  			[]interface{}{
    41  				map[string]interface{}{
    42  					"type":   "manifest",
    43  					"output": "foo",
    44  				},
    45  			},
    46  		},
    47  	}
    48  
    49  	output, err := f.Fix(input)
    50  	assert.NoError(t, err)
    51  
    52  	assert.Equal(t, expected, output)
    53  }