Example #1
0
		err = g2.Fetch()
		Expect(err).ToNot(BeNil())
		Expect(g2.Host).To(Equal(""))
	})

	It("gets all gadgets", func() {
		gadgets, err := quimby.GetGadgets(db)
		Expect(err).To(BeNil())
		Expect(len(gadgets)).To(Equal(1))
		g2 := gadgets[0]
		Expect(g2.Host).To(Equal(ts.URL))
	})

	It("reads the status of the gadget", func() {
		buf := &bytes.Buffer{}
		err := g.ReadStatus(buf)
		Expect(err).To(BeNil())

		var status map[string]map[string]gogadgets.Value
		dec := json.NewDecoder(buf)
		err = dec.Decode(&status)
		Expect(err).To(BeNil())

		Expect(len(status)).To(Equal(5))
		v := status["back yard"]["sprinklers"]
		Expect(v.Value).To(BeFalse())
	})

	It("gets the status of the gadget", func() {
		// status, err := g.Status()
		// Expect(err).To(BeNil())