def test_device_disconnect(self):
        self.assertNotIn(m_hearbeat.device_address, self.bridge_state.connected_devices)

        protocol_loop._accept_step(m_device_connect, self.bridge_state)
        protocol_loop._accept_step(m_device_disconnect, self.bridge_state)

        self.assertNotIn(m_hearbeat.device_address, self.bridge_state.connected_devices)
Exemple #2
0
    def test_device_connect(self):
        self.assertNotIn(m_device_connect.device_address,
                         self.bridge_state.connected_devices)

        protocol_loop._accept_step(m_device_connect, self.bridge_state)

        self.assertIn(m_device_connect.device_address,
                      self.bridge_state.connected_devices)
    def test_encryption_key_required(self):
        # Pretend this printer is claimed:
        hardware.Printer.phone_home('000d6f000273ce0b')
        p = hardware.Printer.query.first()
        p.used_claim_code = 'n5ry-p6x6-kth7-7hc4'
        db.session.add(p)
        db.session.commit()

        protocol_loop.bridge_by_address = {
            self.bridge_state.address: self.bridge_state
        }
        protocol_loop._accept_step(m_encryption_key_required, self.bridge_state)

        self.assertEquals(len(self.bridge_state.websocket.messages), 1)
Exemple #4
0
    def test_encryption_key_required(self):
        # Pretend this printer is claimed:
        hardware.Printer.phone_home('000d6f000273ce0b')
        p = hardware.Printer.query.first()
        p.used_claim_code = 'n5ry-p6x6-kth7-7hc4'
        db.session.add(p)
        db.session.commit()

        protocol_loop.bridge_by_address = {
            self.bridge_state.address: self.bridge_state
        }
        protocol_loop._accept_step(m_encryption_key_required,
                                   self.bridge_state)

        self.assertEquals(len(self.bridge_state.websocket.messages), 1)
    def test_two_heartbeats(self):
        protocol_loop._accept_step(m_hearbeat, self.bridge_state)
        protocol_loop._accept_step(m_hearbeat_2, self.bridge_state)

        self.assertEquals(len(self.bridge_state.connected_devices), 2)
 def test_command_response_unseed_command_id(self):
     protocol_loop._accept_step(m_command_response, self.bridge_state)
 def test_device_double_power_on(self):
     protocol_loop._accept_step(m_power_on, self.bridge_state)
     protocol_loop._accept_step(m_power_on, self.bridge_state)
 def test_bridge_log(self):
     protocol_loop._accept_step(m_bridge_log, self.bridge_state)
Exemple #9
0
    def test_two_heartbeats(self):
        protocol_loop._accept_step(m_hearbeat, self.bridge_state)
        protocol_loop._accept_step(m_hearbeat_2, self.bridge_state)

        self.assertEquals(len(self.bridge_state.connected_devices), 2)
Exemple #10
0
 def test_command_response_unseed_command_id(self):
     protocol_loop._accept_step(m_command_response, self.bridge_state)
Exemple #11
0
 def test_device_double_power_on(self):
     protocol_loop._accept_step(m_power_on, self.bridge_state)
     protocol_loop._accept_step(m_power_on, self.bridge_state)
Exemple #12
0
 def test_bridge_log(self):
     protocol_loop._accept_step(m_bridge_log, self.bridge_state)