Пример #1
0
    def test_instantiate_processor_wrong_cls(self):
        class RandomObject:
            def __init__(self, *args, **kwargs):
                pass

        with pytest.raises(ValidationError, match='should be a subclass of djangosaml2idp.processors.BaseProcessor'):
            instantiate_processor(RandomObject, '')
Пример #2
0
    def test_instantiate_processor_failing_cls(self):
        class FailingProcessor:
            def __init__(self, *args, **kwargs):
                raise NotImplementedError

        with pytest.raises(ImproperlyConfigured, match='Failed to instantiate processor: '):
            instantiate_processor(FailingProcessor, '')
Пример #3
0
 def test_instantiate_processor_valid(self):
     proc = instantiate_processor(BaseProcessor, 'entity_id')
     assert isinstance(proc, BaseProcessor)