-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DE-1394 Remove deprecated v3 Validation (#371)
- Loading branch information
Showing
4 changed files
with
14 additions
and
119 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 |
---|---|---|
|
@@ -36,26 +36,6 @@ func TestEmailValidationV4(t *testing.T) { | |
assert.False(t, ev.Engagement.IsBot) | ||
} | ||
|
||
func TestParseAddresses(t *testing.T) { | ||
v := mailgun.NewEmailValidator(testKey) | ||
v.SetAPIBase(server.URL()) | ||
ctx := context.Background() | ||
|
||
addressesThatParsed, unparsableAddresses, err := v.ParseAddresses(ctx, | ||
"Alice <[email protected]>", | ||
"[email protected]", | ||
"example.com") | ||
require.NoError(t, err) | ||
hittest := map[string]bool{ | ||
"Alice <[email protected]>": true, | ||
"[email protected]": true, | ||
} | ||
for _, a := range addressesThatParsed { | ||
require.True(t, hittest[a]) | ||
} | ||
require.Len(t, unparsableAddresses, 1) | ||
} | ||
|
||
func TestUnmarshallResponse(t *testing.T) { | ||
payload := []byte(`{ | ||
"address": "[email protected]", | ||
|
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 |
---|---|---|
|
@@ -545,19 +545,6 @@ func ListMailingLists(domain, apiKey string) ([]mailgun.MailingList, error) { | |
return result, nil | ||
} | ||
|
||
func ParseAddress(apiKey string) ([]string, []string, error) { | ||
mv := mailgun.NewEmailValidator(apiKey) | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) | ||
defer cancel() | ||
|
||
return mv.ParseAddresses(ctx, | ||
"Alice <[email protected]>", | ||
"[email protected]", | ||
// ... | ||
) | ||
} | ||
|
||
func GetRoute(domain, apiKey string) (mailgun.Route, error) { | ||
mg := mailgun.NewMailgun(domain, apiKey) | ||
|
||
|
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 |
---|---|---|
|
@@ -35,30 +35,6 @@ func ExampleEmailValidatorImpl_ValidateEmail() { | |
} | ||
} | ||
|
||
func ExampleEmailValidatorImpl_ParseAddresses() { | ||
v := mailgun.NewEmailValidator("my_public_validation_api_key") | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer cancel() | ||
|
||
addressesThatParsed, unparsableAddresses, err := v.ParseAddresses(ctx, "Alice <[email protected]>", "[email protected]", "example.com") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
hittest := map[string]bool{ | ||
"Alice <[email protected]>": true, | ||
"[email protected]": true, | ||
} | ||
for _, a := range addressesThatParsed { | ||
if !hittest[a] { | ||
log.Fatalf("Expected %s to be parsable", a) | ||
} | ||
} | ||
if len(unparsableAddresses) != 1 { | ||
log.Fatalf("Expected 1 address to be unparsable; got %d", len(unparsableAddresses)) | ||
} | ||
} | ||
|
||
func ExampleMailgunImpl_UpdateMailingList() { | ||
mg := mailgun.NewMailgun("example.com", "my_api_key") | ||
|
||
|