Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests to increase test coverage #481

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions auth/option_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
11 changes: 10 additions & 1 deletion properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

}
74 changes: 74 additions & 0 deletions transport/http/properties_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
Loading