-
Notifications
You must be signed in to change notification settings - Fork 976
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into hperl/link-credenti…
…als-when-login
- Loading branch information
Showing
15 changed files
with
140 additions
and
241 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 |
---|---|---|
|
@@ -96,7 +96,7 @@ func TestHandler(t *testing.T) { | |
t.Run("case=list messages", func(t *testing.T) { | ||
// Arrange test data | ||
const msgCount = 10 // total message count | ||
const procCount = 5 // how many messages' status should be equal to `processing` | ||
const sentCount = 5 // how many messages' status should be equal to `processing` | ||
const rcptOryCount = 2 // how many messages' recipient should be equal to `[email protected]` | ||
messages := make([]courier.Message, msgCount) | ||
|
||
|
@@ -109,8 +109,8 @@ func TestHandler(t *testing.T) { | |
} | ||
require.NoError(t, reg.CourierPersister().AddMessage(context.Background(), &messages[i])) | ||
} | ||
for i := 0; i < procCount; i++ { | ||
require.NoError(t, reg.CourierPersister().SetMessageStatus(context.Background(), messages[i].ID, courier.MessageStatusProcessing)) | ||
for i := 0; i < sentCount; i++ { | ||
require.NoError(t, reg.CourierPersister().SetMessageStatus(context.Background(), messages[i].ID, courier.MessageStatusSent)) | ||
} | ||
|
||
t.Run("paging", func(t *testing.T) { | ||
|
@@ -146,24 +146,24 @@ func TestHandler(t *testing.T) { | |
for _, tc := range tss { | ||
t.Run("endpoint="+tc.name, func(t *testing.T) { | ||
parsed := getList(t, tc.name, qs) | ||
assert.Len(t, parsed.Array(), msgCount-procCount) | ||
assert.Len(t, parsed.Array(), msgCount-sentCount) | ||
|
||
for _, item := range parsed.Array() { | ||
assert.Equal(t, "queued", item.Get("status").String()) | ||
} | ||
}) | ||
} | ||
}) | ||
t.Run("case=should return all processing messages", func(t *testing.T) { | ||
qs := fmt.Sprintf(`?page_token=%s&page_size=250&status=processing`, defaultPageToken) | ||
t.Run("case=should return all sent messages", func(t *testing.T) { | ||
qs := fmt.Sprintf(`?page_token=%s&page_size=250&status=sent`, defaultPageToken) | ||
|
||
for _, tc := range tss { | ||
t.Run("endpoint="+tc.name, func(t *testing.T) { | ||
parsed := getList(t, tc.name, qs) | ||
assert.Len(t, parsed.Array(), procCount) | ||
assert.Len(t, parsed.Array(), sentCount) | ||
|
||
for _, item := range parsed.Array() { | ||
assert.Equal(t, "processing", item.Get("status").String()) | ||
assert.Equal(t, "sent", item.Get("status").String()) | ||
} | ||
}) | ||
} | ||
|
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
Oops, something went wrong.