def test_authHardwareSendsMessage(self):
        wsmock = WebsocketMock()

        connector = ThingsConectorBase("testid", "node", "descr", 1)
        connector.ws = wsmock
        connector.authHardware()
        self.assertTrue(wsmock.message == '{"data": {"nodeid": "testid", "key": "secretkey"}, "messagetype": "authHardware"}')
    def test_sendNodeInfo(self):
        """Checks if sendNodeInfo works."""
        mock = FunctionMock()
        wsmock = WebsocketMock()

        connector = ThingsConectorBase("nodeid", "nodename", "nodedescr", 1)
        connector.ws = wsmock
        testItem = ThingsItemBase("testid", "type1", "descr")
        connector.addItem(testItem)
        connector.sendNodeInfo()
        message = json.loads(wsmock.message.encode('utf-8'))
        self.assertTrue(message["messagetype"] == 'nodeinfo')
    def test_sendNodeInfoSendsNodeId(self):
        mock = FunctionMock()
        wsmock = WebsocketMock()

        connector = ThingsConectorBase("nodeid", "nodename", "nodedescr", 1)
        connector.ws = wsmock
        testItem = ThingsItemBase("testid", "type1", "descr")
        connector.addItem(testItem)
        connector.sendNodeInfo()
        message = json.loads(wsmock.message.encode('utf-8'))
        data = message["data"]
        self.assertEqual(data['nodeid'], "nodeid")
        self.assertEqual(data['description'], "nodedescr")