コード例 #1
0
ファイル: to_matcher_test.go プロジェクト: robmcl4/gost
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")
}
コード例 #2
0
ファイル: to_matcher_test.go プロジェクト: robmcl4/gost
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")
}
コード例 #3
0
ファイル: to_matcher_test.go プロジェクト: robmcl4/gost
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")
}