Exemplo n.º 1
0
class HW_ThermostatInterfaceTests(TestCase):
    def setUp(self):
        self.host = '192.168.13.210'
#        self.i = HTTP('http', self.host)
        self.i = Mock_Interface()
        self.interface = HW_Thermostat(self.i, self.host)

    def test_instantiation(self):
        self.assertIsInstance(self.interface, HW_Thermostat)
        
    def test_circulate(self):
        self.interface.off(self.host)
        time.sleep(2)
        self.interface.circulate(self.host)
    
    def test_setpoint(self):
        #no prior mode, then default to heat
        self.interface.level(address=self.host, level=72)
        time.sleep(2)
        self.assertIn(('tstat', '{"t_heat": 72}'), self.i.query_write_data())
        self.i.clear_write_data()
        self.interface.cool()
        time.sleep(2)
        self.assertIn(('tstat', '{"tmode": 2, "t_cool": 72}'), self.i.query_write_data())
        
    def test_cool(self):
        self.interface.cool()
        time.sleep(2)
        self.assertIn(('tstat', '{"tmode": 2}'), self.i.query_write_data())
        
Exemplo n.º 2
0
class TomatoInterfaceTests(TestCase):
    def setUp(self):
        self.host = '192.168.13.1'
        #        self.i = HTTP('http', self.host, username='******', password='******')
        self.i = Mock_Interface()
        self.interface = TomatoInterface(self.i,
                                         self.host,
                                         http_id='asdfaadsfasdf234')

    def test_instantiation(self):
        self.assertIsInstance(self.interface, TomatoInterface)

    def test_restriction(self):
        """
        _nextpage:restrict.asp
_service:restrict-restart
rrule1:1|-1|-1|127|192.168.13.119>192.168.13.202|||0|Roku
f_enabled:on
f_desc:Roku
f_sched_allday:on
f_sched_everyday:on
f_sched_begin:0
f_sched_end:0
f_sched_sun:on
f_sched_mon:on
f_sched_tue:on
f_sched_wed:on
f_sched_thu:on
f_sched_fri:on
f_sched_sat:on
f_type:on
f_comp_all:1
f_block_all:on
f_block_http:
_http_id:
"""
        self.interface.restriction('Roku', True)

        time.sleep(2)
        #data = self.i.query_write_data()
        #self.assertIn(("f_desc", "Roku"), data[0].items())
        self.i.clear_write_data()
Exemplo n.º 3
0
class TomatoInterfaceTests(TestCase):
    def setUp(self):
        self.host = "192.168.13.1"
        #        self.i = HTTP('http', self.host, username='******', password='******')
        self.i = Mock_Interface()
        self.interface = TomatoInterface(self.i, self.host, http_id="asdfaadsfasdf234")

    def test_instantiation(self):
        self.assertIsInstance(self.interface, TomatoInterface)

    def test_restriction(self):
        """
        _nextpage:restrict.asp
_service:restrict-restart
rrule1:1|-1|-1|127|192.168.13.119>192.168.13.202|||0|Roku
f_enabled:on
f_desc:Roku
f_sched_allday:on
f_sched_everyday:on
f_sched_begin:0
f_sched_end:0
f_sched_sun:on
f_sched_mon:on
f_sched_tue:on
f_sched_wed:on
f_sched_thu:on
f_sched_fri:on
f_sched_sat:on
f_type:on
f_comp_all:1
f_block_all:on
f_block_http:
_http_id:
"""
        self.interface.restriction("Roku", True)

        time.sleep(2)
        # data = self.i.query_write_data()
        # self.assertIn(("f_desc", "Roku"), data[0].items())
        self.i.clear_write_data()
Exemplo n.º 4
0
class HW_ThermostatInterfaceTests(TestCase):
    def setUp(self):
        self.host = '192.168.13.211'
        #        self.i = HTTP('http', self.host)
        self.i = Mock_Interface()
        self.interface = HW_Thermostat(self.i, self.host)

    def test_instantiation(self):
        self.assertIsInstance(self.interface, HW_Thermostat)

    def test_circulate(self):
        self.interface.off(self.host)
        time.sleep(2)
        #        self.interface.still(self.host)
        self.interface.circulate(self.host)
        time.sleep(2)

    def test_setpoint(self):
        #no prior mode, then default to heat
        self.interface.level(address=self.host, level=72)
        time.sleep(2)
        self.assertIn((
            'tstat',
            '{"t_heat": 72}',
        ), self.i.query_write_data())
        self.i.clear_write_data()
        self.interface.cool()
        time.sleep(2)
        self.assertIn((
            'tstat',
            '{"tmode": 2, "t_cool": 72}',
        ), self.i.query_write_data())

    def test_cool(self):
        self.interface.cool()
        time.sleep(2)
        self.assertIn((
            'tstat',
            '{"tmode": 2}',
        ), self.i.query_write_data())