Ejemplo n.º 1
0
		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)
			client.SetTimeout(timeout)
			protocolSubscription, _ = mockProtocol.NewSubscription()
			clientSubscription, _ = client.NewSubscription()

			mockDevice = new(mocks.Device)
			mockLight = new(mocks.Light)
			mockLocation = new(mocks.Location)
			mockGroup = new(mocks.Group)
		})

		AfterEach(func() {
			mockProtocol.SubscriptionTarget.On(`CloseSubscription`, mock.Anything).Return(nil)
			mockProtocol.On(`Close`).Return(nil)
			_ = client.Close()
		})

		It("should update the timeout", func() {