def test_to_json(self):
        config = Configuration(
            webhook='https://mybot.com/incoming',
            features={'manuallySendReadReceipts': True},
            static_keyboard=SuggestedResponseKeyboard(
                responses=[
                    TextResponse('foo')
                ]
            )
        )

        self.assertEqual(config.to_json(), {
            'webhook': 'https://mybot.com/incoming',
            'features': {
                'manuallySendReadReceipts': True
            },
            'staticKeyboard': {
                'type': 'suggested',
                'responses': [
                    {
                        'type': 'text',
                        'body': 'foo'
                    }
                ]
            }
        })
示例#2
0
    def test_to_json_no_features(self):
        config = Configuration(webhook='https://mybot.com/incoming')

        self.assertEqual(config.to_json(), {
            'webhook': 'https://mybot.com/incoming',
            'features': {}
        })
    def test_to_json_no_features(self):
        config = Configuration(
            webhook='https://mybot.com/incoming'
        )

        self.assertEqual(config.to_json(), {
            'webhook': 'https://mybot.com/incoming',
            'features': {}
        })
示例#4
0
    def test_to_json(self):
        config = Configuration(webhook='https://mybot.com/incoming',
                               features={'manuallySendReadReceipts': True})

        self.assertEqual(
            config.to_json(), {
                'webhook': 'https://mybot.com/incoming',
                'features': {
                    'manuallySendReadReceipts': True
                }
            })
示例#5
0
    def test_to_json(self):
        config = Configuration(
            webhook='https://mybot.com/incoming',
            features={'manuallySendReadReceipts': True}
        )

        self.assertEqual(config.to_json(), {
            'webhook': 'https://mybot.com/incoming',
            'features': {
                'manuallySendReadReceipts': True
            }
        })
    def test_to_json(self):
        config = Configuration(webhook='https://mybot.com/incoming',
                               features={'manuallySendReadReceipts': True},
                               static_keyboard=SuggestedResponseKeyboard(
                                   responses=[TextResponse('foo')]))

        self.assertEqual(
            config.to_json(), {
                'webhook': 'https://mybot.com/incoming',
                'features': {
                    'manuallySendReadReceipts': True
                },
                'staticKeyboard': {
                    'type': 'suggested',
                    'responses': [{
                        'type': 'text',
                        'body': 'foo'
                    }]
                }
            })