-
Notifications
You must be signed in to change notification settings - Fork 0
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 #10 from sasamuku/refactor_support
Refactor support
- Loading branch information
Showing
5 changed files
with
81 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package aws | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/aws/aws-sdk-go-v2/service/support/types" | ||
) | ||
|
||
func Test_Support(t *testing.T) { | ||
caseId := "case-12345678910-2013-c4c1d2bf33c5cf47" | ||
ccEmailAddresses := []string{"[email protected]"} | ||
displayId := "1234567890" | ||
language := "ja" | ||
status := "opened" | ||
subject := "Test Subject" | ||
submittedBy := "[email protected]" | ||
timeCreated := "2021-12-01T12:00:00.000Z" | ||
url := "https://console.aws.amazon.com/support/home#/case/?displayId=1234567890%26language=ja" | ||
|
||
caseDetails := []types.CaseDetails{ | ||
{ | ||
CaseId: &caseId, | ||
CcEmailAddresses: ccEmailAddresses, | ||
DisplayId: &displayId, | ||
Language: &language, | ||
Status: &status, | ||
Subject: &subject, | ||
SubmittedBy: &submittedBy, | ||
TimeCreated: &timeCreated, | ||
}, | ||
} | ||
caseList := makeCaseList(caseDetails) | ||
for _, c := range caseList { | ||
if c.Subject != subject { | ||
t.Fatalf("Fail: got = %v, want = %v", c.Subject, subject) | ||
} | ||
if c.Status != status { | ||
t.Fatalf("Fail: got = %v, want = %v", c.Status, status) | ||
} | ||
if c.SubmittedBy != submittedBy { | ||
t.Fatalf("Fail: got = %v, want = %v", c.SubmittedBy, submittedBy) | ||
} | ||
if c.TimeCreated != timeCreated { | ||
t.Fatalf("Fail: got = %v, want = %v", c.TimeCreated, timeCreated) | ||
} | ||
if c.Url != url { | ||
t.Fatalf("Fail: got = %v, want = %v", c.Url, url) | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -33,7 +33,7 @@ func Test_Notice(t *testing.T) { | |
{ | ||
Subject: "Test", | ||
Status: "opened", | ||
SubmitteBy: "[email protected]", | ||
SubmittedBy: "[email protected]", | ||
TimeCreated: "2021-03-01T01:43:57.974Z", | ||
Url: "https://console.aws.amazon.com/support/home#/case/?displayId=12345%26language=ja", | ||
}, | ||
|
@@ -53,7 +53,7 @@ func Test_Notice(t *testing.T) { | |
payload := NewPayload("AWS Support Case Notice", ConvertToNoticeFormat(tt.cases)) | ||
notice := NewSlackNotice(tt.webhookUrl, payload) | ||
if statusCode := notice.Run(); statusCode != tt.wants.statusCode { | ||
t.Fatalf("run() status: got = %v, want = %v", statusCode, tt.wants.statusCode) | ||
t.Fatalf("Fail: got = %v, want = %v", statusCode, tt.wants.statusCode) | ||
} | ||
}) | ||
} | ||
|