-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit tests to increase test coverage
- Loading branch information
1 parent
a2a3b0b
commit 675af76
Showing
3 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |