Пример #1
0
    def test_Reprocessing(self):
        api = models.Reprocessing()

        def mocked_reprocess(crash_ids):
            if crash_ids == 'some-crash-id':
                return True
            elif crash_ids == 'bad-crash-id':
                return
            raise NotImplementedError(crash_ids)

        models.Reprocessing.implementation().reprocess = mocked_reprocess
        ok_(api.post(crash_ids='some-crash-id'))
        # Note that it doesn't raise an error if
        # the ReprocessingOneRabbitMQCrashStore choses NOT to queue it.
        ok_(not api.post(crash_ids='bad-crash-id'))
Пример #2
0
    def test_Reprocessing(self):
        # This test runs against the Pub/Sub emulator, so undo the mock to let
        # that work.
        self.undo_implementation_mock(models.Reprocessing)

        config_manager = get_config_manager()
        with config_manager.context() as config:
            pubsub_helper = PubSubHelper(config)
            api = models.Reprocessing()

            with pubsub_helper as helper:
                api.post(crash_ids='some-crash-id')

                crash_ids = helper.get_crash_ids('reprocessing')
                assert crash_ids == ['some-crash-id']
Пример #3
0
    def test_Reprocessing(self):
        # This test runs against the AWS SQS emulator, so undo the mock to let
        # that work.
        self.undo_implementation_mock(models.Reprocessing)

        config = get_sqs_config()
        sqs_helper = SQSHelper(config)
        api = models.Reprocessing()

        with sqs_helper as helper:
            crash_id = create_new_ooid()
            api.post(crash_ids=crash_id)

            crash_ids = helper.get_published_crashids("reprocessing")
            assert crash_ids == [crash_id]

        # Now try an invalid crash id
        with pytest.raises(BadArgumentError):
            api.post(crash_ids="some-crash-id")
Пример #4
0
    def test_Reprocessing(self):
        # This test runs against the Pub/Sub emulator, so undo the mock to let
        # that work.
        self.undo_implementation_mock(models.Reprocessing)

        config_manager = get_config_manager()
        with config_manager.context() as config:
            pubsub_helper = PubSubHelper(config)
            api = models.Reprocessing()

            with pubsub_helper as helper:
                crash_id = create_new_ooid()
                api.post(crash_ids=crash_id)

                crash_ids = helper.get_crash_ids("reprocessing")
                assert crash_ids == [crash_id]

            # Now try an invalid crash id
            with pytest.raises(BadArgumentError):
                api.post(crash_ids="some-crash-id")