예제 #1
0
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/lager"
	"github.com/pivotal-golang/lager/lagertest"
	"github.com/robdimsdale/garagepi/api/light"
	test_helpers_fakes "github.com/robdimsdale/garagepi/fakes"
	gpio_fakes "github.com/robdimsdale/garagepi/gpio/fakes"
)

const (
	gpioLightPin = uint(1)
)

var (
	fakeLogger         lager.Logger
	fakeGpio           *gpio_fakes.FakeGpio
	fakeResponseWriter *test_helpers_fakes.FakeResponseWriter

	dummyRequest *http.Request
	lh           light.Handler
)

var _ = Describe("Light", func() {
	var expectedLightState light.LightState
	var expectedReturn []byte
	var err error

	BeforeEach(func() {
		expectedLightState = light.LightState{
			StateKnown: false,
			LightOn:    false,
		}
예제 #2
0
	"github.com/pivotal-golang/lager/lagertest"
	"github.com/robdimsdale/garagepi/api/door"
	test_helpers_fakes "github.com/robdimsdale/garagepi/fakes"
	gpio_fakes "github.com/robdimsdale/garagepi/gpio/fakes"
	os_fakes "github.com/robdimsdale/garagepi/os/fakes"
)

const (
	gpioDoorPin = uint(1)
)

var (
	fakeOSHelper       *os_fakes.FakeOSHelper
	fakeLogger         lager.Logger
	fakeGpio           *gpio_fakes.FakeGpio
	fakeResponseWriter *test_helpers_fakes.FakeResponseWriter

	dummyRequest *http.Request
	dh           door.Handler
)

var _ = Describe("Door", func() {
	BeforeEach(func() {
		fakeLogger = lagertest.NewTestLogger("Door test")
		fakeOSHelper = new(os_fakes.FakeOSHelper)
		fakeGpio = new(gpio_fakes.FakeGpio)
		fakeResponseWriter = new(test_helpers_fakes.FakeResponseWriter)

		dh = door.NewHandler(
			fakeLogger,
			fakeOSHelper,