Exemple #1
0
    def test_with_pattern(self, inline_query):
        handler = InlineQueryHandler(self.callback_basic, pattern='(?P<begin>.*)est(?P<end>.*)')

        assert handler.check_update(inline_query)

        inline_query.inline_query.query = 'nothing here'
        assert not handler.check_update(inline_query)
    def test_with_pattern(self, inline_query):
        handler = InlineQueryHandler(self.callback_basic, pattern='(?P<begin>.*)est(?P<end>.*)')

        assert handler.check_update(inline_query)

        inline_query.inline_query.query = 'nothing here'
        assert not handler.check_update(inline_query)
Exemple #3
0
    async def test_context_pattern(self, app, inline_query):
        handler = InlineQueryHandler(self.callback_pattern,
                                     pattern=r"(?P<begin>.*)est(?P<end>.*)")
        app.add_handler(handler)

        async with app:
            await app.process_update(inline_query)
            assert self.test_flag

            app.remove_handler(handler)
            handler = InlineQueryHandler(self.callback_pattern,
                                         pattern=r"(t)est(.*)")
            app.add_handler(handler)

            await app.process_update(inline_query)
            assert self.test_flag

            update = Update(update_id=0,
                            inline_query=InlineQuery(id="id",
                                                     from_user=None,
                                                     query="",
                                                     offset=""))
            assert not handler.check_update(update)
            update.inline_query.query = "not_a_match"
            assert not handler.check_update(update)
    def test_basic(self, dp, inline_query):
        handler = InlineQueryHandler(self.callback_basic)
        dp.add_handler(handler)

        assert handler.check_update(inline_query)

        dp.process_update(inline_query)
        assert self.test_flag
    def test_basic(self, dp, inline_query):
        handler = InlineQueryHandler(self.callback_basic)
        dp.add_handler(handler)

        assert handler.check_update(inline_query)

        dp.process_update(inline_query)
        assert self.test_flag
 def test_other_update_types(self, false_update):
     handler = InlineQueryHandler(self.callback_basic)
     assert not handler.check_update(false_update)
 def test_other_update_types(self, false_update):
     handler = InlineQueryHandler(self.callback_basic)
     assert not handler.check_update(false_update)