github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/fix/fixer_pp_manifest_filename_test.go (about) 1 package fix 2 3 import ( 4 "reflect" 5 "testing" 6 ) 7 8 func TestFixerManifestPPFilename_Impl(t *testing.T) { 9 var _ Fixer = new(FixerVagrantPPOverride) 10 } 11 12 func TestFixerManifestPPFilename_Fix(t *testing.T) { 13 var f FixerManifestFilename 14 15 input := map[string]interface{}{ 16 "post-processors": []interface{}{ 17 map[string]interface{}{ 18 "type": "manifest", 19 "filename": "foo", 20 }, 21 []interface{}{ 22 map[string]interface{}{ 23 "type": "manifest", 24 "filename": "foo", 25 }, 26 }, 27 }, 28 } 29 30 expected := map[string]interface{}{ 31 "post-processors": []interface{}{ 32 map[string]interface{}{ 33 "type": "manifest", 34 "output": "foo", 35 }, 36 []interface{}{ 37 map[string]interface{}{ 38 "type": "manifest", 39 "output": "foo", 40 }, 41 }, 42 }, 43 } 44 45 output, err := f.Fix(input) 46 if err != nil { 47 t.Fatalf("err: %s", err) 48 } 49 50 if !reflect.DeepEqual(output, expected) { 51 t.Fatalf("unexpected: %#v\nexpected: %#v\n", output, expected) 52 } 53 }