github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/aws/utils_test.go (about) 1 package aws 2 3 import "testing" 4 5 var base64encodingTests = []struct { 6 in []byte 7 out string 8 }{ 9 // normal encoding case 10 {[]byte("data should be encoded"), "ZGF0YSBzaG91bGQgYmUgZW5jb2RlZA=="}, 11 // base64 encoded input should result in no change of output 12 {[]byte("ZGF0YSBzaG91bGQgYmUgZW5jb2RlZA=="), "ZGF0YSBzaG91bGQgYmUgZW5jb2RlZA=="}, 13 } 14 15 func TestBase64Encode(t *testing.T) { 16 for _, tt := range base64encodingTests { 17 out := base64Encode(tt.in) 18 if out != tt.out { 19 t.Errorf("base64Encode(%s) => %s, want %s", tt.in, out, tt.out) 20 } 21 } 22 }