Пример #1
0
    def test_CreeerZaakLk01Error(self, patched_send_signal_and_pdf):
        patched_send_signal_and_pdf.side_effect = CreeerZaakLk01Error('this is a test')

        with self.assertRaises(CreeerZaakLk01Error):
            handle(self.signal)

        self.signal.refresh_from_db()
        self.assertEqual(self.signal.status.state, workflow.VERZENDEN_MISLUKT)
        self.assertEqual(self.signal.status.text, 'Verzending van melding naar THOR is mislukt.')
Пример #2
0
    def test_VoegZaakDocumentToeLk01Error(self, patched_send_signal_and_pdf):
        patched_send_signal_and_pdf.side_effect = VoegZaakDocumentToeLk01Error('this is a test')

        handle(self.signal)

        self.signal.refresh_from_db()

        self.assertEqual(self.signal.status.state, workflow.VERZONDEN)
        self.assertIn('Let op: waarschijnlijk is de PDF niet verzonden naar CityControl.',
                      self.signal.status.text)
Пример #3
0
    def test_too_many(self,
                      patched_send_voegZaakdocumentToe_Lk01,
                      patched_send_creeerZaak_Lk01,):
        CityControlRoundtrip.objects.create(_signal=self.signal)
        CityControlRoundtrip.objects.create(_signal=self.signal)
        CityControlRoundtrip.objects.create(_signal=self.signal)

        with self.assertRaises(SentTooManyTimesError):
            handle(self.signal)
        patched_send_voegZaakdocumentToe_Lk01.assert_not_called()
Пример #4
0
def push_to_sigmax(pk):
    """
    Send signals to Sigmax if applicable

    :param pk:
    :return: Nothing
    """
    try:
        signal = Signal.objects.get(pk=pk)
    except Signal.DoesNotExist:
        logger.exception()
        return None

    if is_signal_applicable(signal):
        handle(signal)
Пример #5
0
    def test_success_message(self, patched_send_voegZaakdocumentToe_Lk01,
                             patched_send_creeerZaak_Lk01):
        success_response = mock.Mock()
        success_response.status_code = 200
        patched_send_creeerZaak_Lk01.return_value = success_response

        handle(self.signal)
        self.signal.refresh_from_db()

        last_status = Status.objects.filter(
            _signal=self.signal).order_by('id').last()
        self.assertIn(
            f'Verzending van melding naar THOR is gelukt onder nummer {self.signal.sia_id}.01.',  # noqa
            last_status.text,
        )