mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 09:37:02 +00:00
Use enum for MailboxNaming for #33
This commit is contained in:
@@ -25,7 +25,7 @@ func (a *Addressing) ExtractMailbox(address string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if a.Config.MailboxNaming == "local" {
|
||||
if a.Config.MailboxNaming == config.LocalNaming {
|
||||
return local, nil
|
||||
}
|
||||
if domain == "" {
|
||||
|
||||
@@ -123,8 +123,8 @@ func TestShouldStoreDomain(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExtractMailboxValid(t *testing.T) {
|
||||
localPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: "local"}}
|
||||
fullPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: "full"}}
|
||||
localPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: config.LocalNaming}}
|
||||
fullPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: config.FullNaming}}
|
||||
|
||||
testTable := []struct {
|
||||
input string // Input to test
|
||||
@@ -251,8 +251,8 @@ func TestExtractMailboxValid(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExtractMailboxInvalid(t *testing.T) {
|
||||
localPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: "local"}}
|
||||
fullPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: "full"}}
|
||||
localPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: config.LocalNaming}}
|
||||
fullPolicy := policy.Addressing{Config: &config.Root{MailboxNaming: config.FullNaming}}
|
||||
// Test local mailbox naming policy.
|
||||
localInvalidTable := []struct {
|
||||
input, msg string
|
||||
|
||||
Reference in New Issue
Block a user