Exemple #1
0
func TestNegativeMatchNoAddressees(t *testing.T) {
	e_smtp := email.SMTPEmail{
		Contents: []byte(
			`Foo: bar
Bar: baz
The-Thing: Other-Thing

A body to the message
`),
	}
	e, err := e_smtp.Parse()
	assert.Nil(t, err)
	matcher := NewToMatcher("*****@*****.**")
	assert.False(t, matcher.Matches(e), "should match email")
}
Exemple #2
0
func TestPositiveMatch(t *testing.T) {
	e_smtp := email.SMTPEmail{
		Contents: []byte(
			`Foo: bar
Bar: baz
The-Thing: Other-Thing
To: The Dude <*****@*****.**>

A body to the message
`),
	}
	e, err := e_smtp.Parse()
	assert.Nil(t, err)
	matcher := NewToMatcher("*****@*****.**")
	assert.True(t, matcher.Matches(e), "should match email")
}
Exemple #3
0
func TestNegativeMatchMultiple(t *testing.T) {
	e_smtp := email.SMTPEmail{
		Contents: []byte(
			`Foo: bar
Bar: baz
The-Thing: Other-Thing
To: "The Dude" <*****@*****.**>, "The Other Dude" <*****@*****.**>

A body to the message
`),
	}
	e, err := e_smtp.Parse()
	assert.Nil(t, err)
	matcher := NewToMatcher("*****@*****.**")
	assert.False(t, matcher.Matches(e), "should match email")
}