-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from AirHelp/feature/overwrite-aws-config
DOT-1036 feat(client): Add option to overwrite aws config
- Loading branch information
Showing
7 changed files
with
53 additions
and
41 deletions.
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
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
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 |
---|---|---|
@@ -1,21 +1,42 @@ | ||
package client_test | ||
package client | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/AirHelp/treasury/client" | ||
"github.com/aws/aws-sdk-go/aws" | ||
) | ||
|
||
func TestClient(t *testing.T) { | ||
func TestNew(t *testing.T) { | ||
type args struct { | ||
options *Options | ||
} | ||
tests := []struct { | ||
options *client.Options | ||
name string | ||
args args | ||
want *Client | ||
wantErr bool | ||
}{ | ||
{&client.Options{S3BucketName: "fake_s3_bucket_name"}}, | ||
{ | ||
name: "empty options", | ||
args: args{options: &Options{}}, | ||
want: &Client{}, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "add aws config", | ||
args: args{options: &Options{AWSConfig: aws.Config{Region: aws.String("eu-west-1")}}}, | ||
want: &Client{}, | ||
wantErr: false, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
if _, got := client.New(test.options); got != nil { | ||
t.Fatalf("Could not initialize client. Error:%s", got) | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_, err := New(tt.args.options) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
}) | ||
} | ||
} |
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