Example #1
0
package mail

import (
	"testing"

	"github.com/corestoreio/csfw/config"
	"github.com/stretchr/testify/assert"
)

var configMock = config.NewMockReader(
	config.MockInt(func(path string) int {
		//		println("int", path)
		switch path {
		case "stores/5015/system/smtp/port":
			return 0
		case "stores/6023/system/smtp/port":
			return 4040
		default:
			return 0
		}
	}),
	config.MockString(func(path string) string {
		//		println("string", path)
		switch path {
		case "stores/5015/system/smtp/host":
			return ""
		case "stores/5015/system/smtp/username":
			return ""
		case "stores/6023/system/smtp/host":
			return "smtp.fastmail.com"
		case "stores/6023/system/smtp/username":
Example #2
0
package email_test

import (
	"bytes"
	"io"
	"testing"

	"github.com/corestoreio/csfw/config"
	"github.com/corestoreio/csfw/utils/mail"
	"github.com/go-gomail/gomail"
	"github.com/stretchr/testify/assert"
)

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
		}