Example #1
0
		lightLabel         = `mockLight`

		locationID           = `mockLocationID`
		locationUnknownID    = `unknownLocationID`
		locationLabel        = `mockLocation`
		locationUnknownLabel = `unknownLocation`
		groupID              = `mockGroupID`
		groupUnknownID       = `unknownGroupID`
		groupLabel           = `mockGroup`
		groupUnknownLabel    = `unknownGroup`
	)

	It("should send discovery to the protocol on NewClient", func() {
		var err error
		mockProtocol = new(mocks.Protocol)
		mockProtocol.On(`SetClient`, mock.Anything).Return()
		mockProtocol.SubscriptionTarget.On(`NewSubscription`).Return(common.NewSubscription(mockProtocol), nil)
		mockProtocol.On(`Discover`).Return(nil).Once()

		client, err = NewClient(mockProtocol)
		Expect(client).To(BeAssignableToTypeOf(new(Client)))
		Expect(err).NotTo(HaveOccurred())
	})

	Describe("Client", func() {
		BeforeEach(func() {
			mockProtocol = new(mocks.Protocol)
			mockProtocol.On(`SetClient`, mock.Anything).Return()
			mockProtocol.SubscriptionTarget.On(`NewSubscription`).Return(common.NewSubscription(mockProtocol), nil)
			mockProtocol.On(`Discover`).Return(nil).Once()
			client, _ = NewClient(mockProtocol)
Example #2
0
		lightLabel         = `mockLight`

		locationID           = `mockLocationID`
		locationUnknownID    = `unknownLocationID`
		locationLabel        = `mockLocation`
		locationUnknownLabel = `unknownLocation`
		groupID              = `mockGroupID`
		groupUnknownID       = `unknownGroupID`
		groupLabel           = `mockGroup`
		groupUnknownLabel    = `unknownGroup`
	)

	It("should send discovery to the protocol on NewClient", func() {
		var err error
		mockProtocol = new(mocks.Protocol)
		mockProtocol.On(`SetTimeout`, mock.AnythingOfType("*time.Duration")).Return().Once()
		mockProtocol.On(`SetRetryInterval`, mock.AnythingOfType("*time.Duration")).Return().Once()
		mockProtocol.On(`SetClient`, mock.Anything).Return().Once()
		mockProtocol.SubscriptionTarget.On(`NewSubscription`).Return(common.NewSubscription(mockProtocol), nil).Once()
		mockProtocol.On(`Discover`).Return(nil).Once()

		client, err = NewClient(mockProtocol)
		Expect(client).To(BeAssignableToTypeOf(new(Client)))
		Expect(err).NotTo(HaveOccurred())
	})

	Describe("Client", func() {
		BeforeEach(func() {
			mockProtocol = new(mocks.Protocol)
			protocolSubscription = common.NewSubscription(mockProtocol)
			mockProtocol.SubscriptionTarget.On(`NewSubscription`).Return(protocolSubscription, nil).Once()