diff --git a/auth/option_test.go b/auth/option_test.go new file mode 100644 index 000000000..3ff4cf304 --- /dev/null +++ b/auth/option_test.go @@ -0,0 +1,31 @@ +package auth + +import ( + "testing" + "reflect" + smithy "github.com/aws/smithy-go" +) + +func TestAuthOptions(t *testing.T) { + var ip smithy.Properties + ip.Set("foo", "bar") + + var sp smithy.Properties + sp.Set("foo", "bar") + + expected := []*Option{ + &Option{ + SchemeID: "fakeSchemeID", + IdentityProperties: ip, + SignerProperties: sp, + }, + } + + var m smithy.Properties + SetAuthOptions(&m, expected) + actual, _ := GetAuthOptions(&m) + + if !reflect.DeepEqual(expected, actual) { + t.Errorf("Expect AuthOptions to be equivalent %v != %v", expected, actual) + } +} \ No newline at end of file diff --git a/properties_test.go b/properties_test.go index 93637c3b1..8e75130b9 100644 --- a/properties_test.go +++ b/properties_test.go @@ -17,4 +17,13 @@ func TestProperties(t *testing.T) { t.Errorf("expect key / value properties to be equivalent: %v / %v", k, v) } } -} + + var n Properties + n.SetAll(&m) + for k, v := range original { + if n.Get(k) != v { + t.Errorf("expect key / value properties to be equivalent: %v / %v", k, v) + } + } + +} \ No newline at end of file diff --git a/transport/http/properties_test.go b/transport/http/properties_test.go new file mode 100644 index 000000000..f79cde2f4 --- /dev/null +++ b/transport/http/properties_test.go @@ -0,0 +1,74 @@ +package http + +import ( + "testing" + "reflect" + smithy "github.com/aws/smithy-go" +) + + +func TestSigV4SigningName(t *testing.T) { + expected := "foo" + var m smithy.Properties + SetSigV4SigningName(&m, expected) + actual, _ := GetSigV4SigningName(&m) + + if expected != actual { + t.Errorf("Expect SigV4SigningName to be equivalent %s != %s", expected, actual) + } +} + +func TestSigV4SigningRegion(t *testing.T) { + expected := "foo" + var m smithy.Properties + SetSigV4SigningRegion(&m, expected) + actual, _ := GetSigV4SigningRegion(&m) + + if expected != actual { + t.Errorf("Expect SigV4SigningRegion to be equivalent %s != %s", expected, actual) + } +} + +func TestSigV4ASigningName(t *testing.T) { + expected := "foo" + var m smithy.Properties + SetSigV4ASigningName(&m, expected) + actual, _ := GetSigV4ASigningName(&m) + + if expected != actual { + t.Errorf("Expect SigV4ASigningName to be equivalent %s != %s", expected, actual) + } +} + +func TestSigV4SigningRegions(t *testing.T) { + expected := []string{"foo", "bar"} + var m smithy.Properties + SetSigV4ASigningRegions(&m, expected) + actual, _ := GetSigV4ASigningRegions(&m) + + if !reflect.DeepEqual(expected, actual) { + t.Errorf("Expect SigV4ASigningRegions to be equivalent %v != %v", expected, actual) + } +} + +func TestUnsignedPayload(t *testing.T) { + expected := true + var m smithy.Properties + SetIsUnsignedPayload(&m, expected) + actual, _ := GetIsUnsignedPayload(&m) + + if expected != actual { + t.Errorf("Expect IsUnsignedPayload to be equivalent %v != %v", expected, actual) + } +} + +func TestDisableDoubleEncoding(t *testing.T) { + expected := true + var m smithy.Properties + SetDisableDoubleEncoding(&m, expected) + actual, _ := GetDisableDoubleEncoding(&m) + + if expected != actual { + t.Errorf("Expect DisableDoubleEncoding to be equivalent %v != %v", expected, actual) + } +} \ No newline at end of file