コード例 #1
0
ファイル: daemon_dialer_test.go プロジェクト: levcom/csfw
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":
コード例 #2
0
ファイル: mocks_test.go プロジェクト: levcom/csfw
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
		}