コード例 #1
0
    async def test_on_interaction_on_deserialize_unrecognised_entity_error(
            self, mock_interaction_server, mock_entity_factory):
        mock_interaction_server._verify = mock.Mock(return_value=True)
        mock_entity_factory.deserialize_interaction.side_effect = errors.UnrecognisedEntityError(
            "blah")

        result = await mock_interaction_server.on_interaction(
            b'{"type": 2}', b"signature", b"timestamp")

        assert result.headers == {"Content-Type": "text/plain; charset=UTF-8"}
        assert result.payload == b"Interaction type not implemented"
        assert result.status_code == 501
コード例 #2
0
    async def test_on_interaction_on_deserialize_unrecognised_entity_error(
        self,
        mock_interaction_server: interaction_server_impl.InteractionServer,
        mock_entity_factory: entity_factory_impl.EntityFactoryImpl,
    ):
        mock_interaction_server._public_key = mock.Mock()
        mock_entity_factory.deserialize_interaction.side_effect = errors.UnrecognisedEntityError("blah")

        result = await mock_interaction_server.on_interaction(b'{"type": 2}', b"signature", b"timestamp")

        assert result.content_type == "text/plain; charset=UTF-8"
        assert result.files == ()
        assert result.headers is None
        assert result.payload == b"Interaction type not implemented"
        assert result.status_code == 501
コード例 #3
0
ファイル: test_errors.py プロジェクト: Forbidden-A/hikari
 def error(self):
     return errors.UnrecognisedEntityError("some reason")