Exemplo n.º 1
0
package email

import (
	"testing"

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

var configMock = config.NewMockReader(
	config.WithMockInt(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.WithMockString(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":
Exemplo n.º 2
0
package email_test

import (
	"bytes"
	"io"
	"testing"

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

var configMock = config.NewMockReader(
	config.WithMockInt(func(path string) int {
		//println("int", path)
		return 25 // Port 25
	}),
	config.WithMockString(func(path string) string {
		//println("string", path)
		return "localhost"
	}),
	config.WithMockBool(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
		}