async def test_process_message(self):
        """Test processing a mattermost message."""
        connector = ConnectorMattermost(
            {
                "token": "abc123",
                "url": "localhost",
                "team-name": "opsdroid",
                "scheme": "http",
            },
            opsdroid=OpsDroid(),
        )
        connector.opsdroid = amock.CoroutineMock()
        connector.opsdroid.parse = amock.CoroutineMock()

        post = json.dumps(
            {
                "id": "wr9wetwc87bgdcx6opkjaxwb6a",
                "create_at": 1574001673419,
                "update_at": 1574001673419,
                "edit_at": 0,
                "delete_at": 0,
                "is_pinned": False,
                "user_id": "mrtopue9oigr8poa3bgfq4if4a",
                "channel_id": "hdnm8gbxfp8bmcns7oswmwur4r",
                "root_id": "",
                "parent_id": "",
                "original_id": "",
                "message": "hello",
                "type": "",
                "props": {},
                "hashtags": "",
                "pending_post_id": "mrtopue9oigr8poa3bgfq4if4a:1574001673362",
                "metadata": {},
            }
        )

        message = json.dumps(
            {
                "event": "posted",
                "data": {
                    "channel_display_name": "@daniccan",
                    "channel_name": "546qd6zsyffcfcafd77a3kdadr__mrtopue9oigr8poa3bgfq4if4a",
                    "channel_type": "D",
                    "mentions": '["546qd6zsyffcfcafd77a3kdadr"]',
                    "post": post,
                    "sender_name": "@daniccan",
                    "team_id": "",
                },
                "broadcast": {
                    "omit_users": "",
                    "user_id": "",
                    "channel_id": "hdnm8gbxfp8bmcns7oswmwur4r",
                    "team_id": "",
                },
                "seq": 3,
            }
        )
        await connector.process_message(message)
        self.assertTrue(connector.opsdroid.parse.called)
    async def test_do_not_process_own_message(self):
        """Test that we do not process our own messages when connected to Mattermost."""
        connector = ConnectorMattermost(
            {
                "token": "abc123",
                "url": "localhost",
                "team-name": "opsdroid",
                "scheme": "http",
            },
            opsdroid=OpsDroid(),
        )
        opsdroid = amock.CoroutineMock()
        opsdroid.eventloop = self.loop
        connector.mm_driver.login = mock.MagicMock()
        connector.mm_driver.login.return_value = {"id": "1", "username": "******"}
        await connector.connect()
        self.assertEqual("1", connector.bot_id)
        self.assertEqual("opsdroid_bot", connector.bot_name)

        connector.opsdroid = amock.CoroutineMock()
        connector.opsdroid.eventloop = self.loop
        connector.opsdroid.parse = amock.CoroutineMock()

        post = json.dumps(
            {
                "id": "wr9wetwc87bgdcx6opkjaxwb7b",
                "create_at": 1574001673420,
                "update_at": 1574001673420,
                "edit_at": 0,
                "delete_at": 0,
                "is_pinned": False,
                "user_id": "1",
                "channel_id": "hdnm8gbxfp8bmcns7oswmwur4r",
                "root_id": "",
                "parent_id": "",
                "original_id": "",
                "message": "hello",
                "type": "",
                "props": {},
                "hashtags": "",
                "pending_post_id": "mrtopue9oigr8poa3bgfq4if4a:1574001673372",
                "metadata": {},
            }
        )

        message = json.dumps(
            {
                "event": "posted",
                "data": {
                    "channel_display_name": "@daniccan",
                    "channel_name": "546qd6zsyffcfcafd77a3kdadr__mrtopue9oigr8poa3bgfq4if4a",
                    "channel_type": "D",
                    "mentions": '["546qd6zsyffcfcafd77a3kdadr"]',
                    "post": post,
                    "sender_name": "@opsdroid_bot",
                    "team_id": "",
                },
                "broadcast": {
                    "omit_users": "",
                    "user_id": "",
                    "channel_id": "hdnm8gbxfp8bmcns7oswmwur4r",
                    "team_id": "",
                },
                "seq": 4,
            }
        )
        await connector.process_message(message)
        self.assertFalse(connector.opsdroid.parse.called)