Пример #1
0
    def test_webhook_model(self):

        webhook_data = {
            'token': 'wbh-12345',
            'createdOn': '2017-01-01',
            'type': 'USERS.CREATED',
            'object': self.user_data
        }

        test_webhook = Webhook(webhook_data)

        self.assertEqual(
            test_webhook.__repr__(), 'Webhook({date}, {token})'.format(
                date=webhook_data.get('createdOn'),
                token=webhook_data.get('token')))
Пример #2
0
    def test_webhook_model_bad_type(self):

        webhook_data = {
            'token': 'wbh-12345',
            'createdOn': '2017-01-01',
            'type': 'USER.PAYMENT',
            'object': self.user_data
        }

        test_webhook = Webhook(webhook_data)

        self.assertEqual(test_webhook.object, webhook_data.get('object'))
Пример #3
0
    def test_webhook_model_bad_object(self):

        webhook_data = {
            'token': 'wbh-12345',
            'createdOn': '2017-01-01',
            'type': 'USERS.CREATED',
            'object': 'hi'
        }

        test_webhook = Webhook(webhook_data)

        self.assertEqual(test_webhook.object, webhook_data.get('object'))
Пример #4
0
    def test_webhook_model_good_sub_type(self):

        webhook_data = {
            'token': 'wbh-12345',
            'createdOn': '2017-01-01',
            'type': 'USER.BANK_ACCOUNTS.CREATED',
            'object': self.transfer_method_data
        }

        test_webhook = Webhook(webhook_data)

        self.assertEqual(
            test_webhook.object.__repr__(),
            'BankAccount({date}, {token})'.format(
                date=self.transfer_method_data.get('createdOn'),
                token=self.transfer_method_data.get('token')))