1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-21 11:37:07 +00:00

policy: Accept Root config instead of SMTP for #33

This commit is contained in:
James Hillyerd
2018-04-02 19:43:05 -07:00
parent 8c66a24513
commit c2e1d58b90
4 changed files with 46 additions and 36 deletions

View File

@@ -11,9 +11,11 @@ import (
func TestShouldAcceptDomain(t *testing.T) {
// Test with default accept.
ap := &policy.Addressing{
Config: config.SMTP{
DefaultAccept: true,
RejectDomains: []string{"a.deny.com", "deny.com"},
Config: &config.Root{
SMTP: config.SMTP{
DefaultAccept: true,
RejectDomains: []string{"a.deny.com", "deny.com"},
},
},
}
testCases := []struct {
@@ -36,9 +38,11 @@ func TestShouldAcceptDomain(t *testing.T) {
}
// Test with default reject.
ap = &policy.Addressing{
Config: config.SMTP{
DefaultAccept: false,
AcceptDomains: []string{"a.allow.com", "allow.com"},
Config: &config.Root{
SMTP: config.SMTP{
DefaultAccept: false,
AcceptDomains: []string{"a.allow.com", "allow.com"},
},
},
}
testCases = []struct {
@@ -64,9 +68,11 @@ func TestShouldAcceptDomain(t *testing.T) {
func TestShouldStoreDomain(t *testing.T) {
// Test with storage enabled.
ap := &policy.Addressing{
Config: config.SMTP{
DefaultStore: false,
StoreDomains: []string{"store.com", "a.store.com"},
Config: &config.Root{
SMTP: config.SMTP{
DefaultStore: false,
StoreDomains: []string{"store.com", "a.store.com"},
},
},
}
testCases := []struct {
@@ -89,9 +95,11 @@ func TestShouldStoreDomain(t *testing.T) {
}
// Test with storage disabled.
ap = &policy.Addressing{
Config: config.SMTP{
DefaultStore: true,
DiscardDomains: []string{"discard.com", "a.discard.com"},
Config: &config.Root{
SMTP: config.SMTP{
DefaultStore: true,
DiscardDomains: []string{"discard.com", "a.discard.com"},
},
},
}
testCases = []struct {