diff --git a/attachments_test.go b/attachments_test.go index 0aba4210..b1ef8a1d 100644 --- a/attachments_test.go +++ b/attachments_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4" "github.com/mailgun/mailgun-go/v4/events" "github.com/stretchr/testify/require" @@ -44,7 +43,7 @@ func TestMultipleAttachments(t *testing.T) { t.Logf("New Email: %s Id: %s\n", msg, id) e, err := findAcceptedMessage(mg, id) - ensure.NotNil(t, e) + require.NotNil(t, e) require.Equal(t, e.ID, id) require.Len(t, e.Message.Attachments, 2) diff --git a/bounces_test.go b/bounces_test.go index 169c61bb..18cf0641 100644 --- a/bounces_test.go +++ b/bounces_test.go @@ -11,8 +11,6 @@ import ( "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" - - "github.com/facebookgo/ensure" ) func TestGetBounces(t *testing.T) { @@ -39,7 +37,7 @@ func TestGetSingleBounce(t *testing.T) { exampleEmail := fmt.Sprintf("%s@%s", strings.ToLower(randomString(64, "")), os.Getenv("MG_DOMAIN")) _, err := mg.GetBounce(ctx, exampleEmail) - ensure.NotNil(t, err) + require.NotNil(t, err) var ure *mailgun.UnexpectedResponseError require.ErrorAs(t, err, &ure) diff --git a/events_test.go b/events_test.go index e3bd7af2..18359c35 100644 --- a/events_test.go +++ b/events_test.go @@ -106,7 +106,7 @@ func TestEventPoller(t *testing.T) { } } // Ensure we found our email - ensure.NotNil(t, it.Err()) + require.NotNil(t, it.Err()) require.NotNil(t, accepted) require.Equal(t, "user@"+testDomain, accepted.Recipient) } diff --git a/mailing_lists_test.go b/mailing_lists_test.go index 1b758f6e..54938699 100644 --- a/mailing_lists_test.go +++ b/mailing_lists_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" ) @@ -90,7 +89,7 @@ func TestMailingListMembers(t *testing.T) { theMember, err = mg.GetMember(ctx, "joe.user2@example.com", address) require.NoError(t, err) require.Equal(t, "Joe's Cool Account", theMember.Name) - ensure.NotNil(t, theMember.Subscribed) + require.NotNil(t, theMember.Subscribed) require.True(t, *theMember.Subscribed) } @@ -125,7 +124,7 @@ func TestMailingLists(t *testing.T) { require.NoError(t, mg.DeleteMailingList(ctx, address)) _, err := mg.GetMailingList(ctx, address) - ensure.NotNil(t, err) + require.NotNil(t, err) }() actualCount := countLists() diff --git a/messages_test.go b/messages_test.go index 281049c5..1a0ccf85 100644 --- a/messages_test.go +++ b/messages_test.go @@ -260,7 +260,7 @@ func TestSendMGBatchFailRecipients(t *testing.T) { err := m.AddRecipientAndVariables(toUser, nil) // In case of error the SDK didn't send the message, // OR the API didn't check for empty To: headers. - ensure.NotNil(t, err) + require.NotNil(t, err) }) } @@ -417,7 +417,7 @@ func TestAddRecipientsError(t *testing.T) { } err := m.AddRecipient("recipient_1001@example.com") - ensure.NotNil(t, err) + require.NotNil(t, err) require.EqualError(t, err, "recipient limit exceeded (max 1000)") } @@ -491,7 +491,7 @@ func TestSendEOFError(t *testing.T) { m := mailgun.NewMessage(fromUser, exampleSubject, exampleText, toUser) _, _, err := mg.Send(context.Background(), m) - ensure.NotNil(t, err) + require.NotNil(t, err) ensure.StringContains(t, err.Error(), "remote server prematurely closed connection: Post ") ensure.StringContains(t, err.Error(), "EOF") } @@ -553,7 +553,7 @@ func TestResendStored(t *testing.T) { mg.SetAPIBase(srv.URL + "/v3") msg, id, err := mg.ReSend(context.Background(), srv.URL+"/v3/some-url") - ensure.NotNil(t, err) + require.NotNil(t, err) require.Equal(t, err.Error(), "must provide at least one recipient") msg, id, err = mg.ReSend(context.Background(), srv.URL+"/v3/some-url", toUser) diff --git a/routes_test.go b/routes_test.go index d55cebb7..f4a7a31c 100644 --- a/routes_test.go +++ b/routes_test.go @@ -39,7 +39,7 @@ func TestRouteCRUD(t *testing.T) { defer func() { require.NoError(t, mg.DeleteRoute(ctx, newRoute.Id)) _, err = mg.GetRoute(ctx, newRoute.Id) - ensure.NotNil(t, err) + require.NotNil(t, err) }() newCount := countRoutes() diff --git a/spam_complaints_test.go b/spam_complaints_test.go index 1c59c07f..8a51c005 100644 --- a/spam_complaints_test.go +++ b/spam_complaints_test.go @@ -6,7 +6,6 @@ import ( "strings" "testing" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" ) @@ -31,7 +30,7 @@ func TestGetComplaintFromRandomNoComplaint(t *testing.T) { ctx := context.Background() _, err := mg.GetComplaint(ctx, randomString(64, "")+"@example.com") - ensure.NotNil(t, err) + require.NotNil(t, err) var ure *mailgun.UnexpectedResponseError require.ErrorAs(t, err, &ure) diff --git a/subaccounts_test.go b/subaccounts_test.go index e4a50f84..d4ae8fd0 100644 --- a/subaccounts_test.go +++ b/subaccounts_test.go @@ -5,7 +5,6 @@ import ( "net/http" "testing" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" ) @@ -21,7 +20,7 @@ func TestListSubaccounts(t *testing.T) { mg.SetAPIBase(server.URL()) iterator := mg.ListSubaccounts(nil) - ensure.NotNil(t, iterator) + require.NotNil(t, iterator) ctx := context.Background() @@ -43,7 +42,7 @@ func TestSubaccountDetails(t *testing.T) { ctx := context.Background() iterator := mg.ListSubaccounts(nil) - ensure.NotNil(t, iterator) + require.NotNil(t, iterator) page := []mailgun.Subaccount{} require.True(t, iterator.Next(context.Background(), &page)) @@ -51,7 +50,7 @@ func TestSubaccountDetails(t *testing.T) { resp, err := mg.SubaccountDetails(ctx, page[0].Id) require.NoError(t, err) - ensure.NotNil(t, resp) + require.NotNil(t, resp) } func TestSubaccountDetailsStatusNotFound(t *testing.T) { @@ -77,7 +76,7 @@ func TestCreateSubaccount(t *testing.T) { resp, err := mg.CreateSubaccount(ctx, testSubaccountName) require.NoError(t, err) - ensure.NotNil(t, resp) + require.NotNil(t, resp) } func TestEnableSubaccountAlreadyEnabled(t *testing.T) { diff --git a/tags_test.go b/tags_test.go index 87dfe7d6..1cdea4bf 100644 --- a/tags_test.go +++ b/tags_test.go @@ -5,7 +5,6 @@ import ( "testing" "time" - "github.com/facebookgo/ensure" "github.com/mailgun/errors" "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" @@ -24,8 +23,8 @@ func TestTags(t *testing.T) { require.NoError(t, msg.AddTag("newsletter")) require.NoError(t, msg.AddTag("homer")) require.NoError(t, msg.AddTag("bart")) - ensure.NotNil(t, msg.AddTag("disco-steve")) - ensure.NotNil(t, msg.AddTag("newsletter")) + require.NotNil(t, msg.AddTag("disco-steve")) + require.NotNil(t, msg.AddTag("newsletter")) ctx := context.Background() // Create an email with some tags attached @@ -60,7 +59,7 @@ func TestTags(t *testing.T) { require.Equal(t, "homer", tag.Value) _, err = mg.GetTag(ctx, "i-dont-exist") - ensure.NotNil(t, err) + require.NotNil(t, err) require.Equal(t, 404, mailgun.GetStatusFromErr(err)) }