Beispiel #1
0
			return ""
		case "stores/5015/system/smtp/username":
			return ""
		case "stores/6023/system/smtp/host":
			return "smtp.fastmail.com"
		case "stores/6023/system/smtp/username":
			return "2522e71a49e"
		case "stores/6023/system/smtp/password":
			return "9512e71a49f"
		default:
			return ""
		}

	}),
	config.MockBool(func(path string) bool {
		return false
	}),
)

func TestDialerPoolDefaultConfig(t *testing.T) {
	dm, err := NewDaemon(
		SetConfig(configMock),
		SetScope(config.ScopeID(5015)),
	)
	assert.NoError(t, err)
	assert.NotNil(t, dm)
	assert.Equal(t, uint64(0xcc72e0b18f4a60fb), dm.ID()) // "localhost25"
}

func TestDialerPoolSingleton(t *testing.T) {
	dm1, err := NewDaemon(
Beispiel #2
0
var configMock = config.NewMockReader(
	config.MockInt(func(path string) int {
		//println("int", path)
		return 25 // Port 25
	}),
	config.MockString(func(path string) string {
		//println("string", path)
		return "localhost"
	}),
	config.MockBool(func(path string) bool {
		//println("bool", path)
		switch path {
		case "stores/3001/system/smtp/disable":
			return true
		case "stores/4010/system/smtp/disable":
			return false
		default:
			return false
		}
	}),
)

type mockDial struct {
	t        *testing.T
	dialErr  error
	sendErr  error
	closeErr error
}

func (md mockDial) Dial() (gomail.SendCloser, error) {