Example #1
0
    def test_handle_event_payment_succeeded(self, invoice_retrieve_mock, sync_invoice_mock):
        fake_event = Event(kind="invoice.payment_failed", validated_message={"data": {"object": {"id": "lock"}}})

        Invoice.handle_event(fake_event)

        invoice_retrieve_mock.assert_called_once_with("lock")
        sync_invoice_mock.assert_called_once_with("key", send_receipt=True)
Example #2
0
    def test_handle_event_fake(self, invoice_retrieve_mock, sync_invoice_mock):
        fake_event = Event(kind="fake", message={"data": {"object": {"id": "door"}}})

        Invoice.handle_event(fake_event)

        self.assertFalse(invoice_retrieve_mock.called)
        self.assertFalse(sync_invoice_mock.called)
Example #3
0
    def test_handle_event_fake(self, invoice_retrieve_mock, sync_invoice_mock):
        fake_event = Event(kind="fake",
                           message={"data": {
                               "object": {
                                   "id": "door"
                               }
                           }})

        Invoice.handle_event(fake_event)

        self.assertFalse(invoice_retrieve_mock.called)
        self.assertFalse(sync_invoice_mock.called)
Example #4
0
    def test_handle_event_payment_succeeded(self, invoice_retrieve_mock,
                                            sync_invoice_mock):
        fake_event = Event(
            kind="invoice.payment_failed",
            validated_message={"data": {
                "object": {
                    "id": "lock"
                }
            }})

        Invoice.handle_event(fake_event)

        invoice_retrieve_mock.assert_called_once_with("lock")
        sync_invoice_mock.assert_called_once_with("key", send_receipt=True)