def test_select_handler_not_found_in_registry(handlers_module): dehydrator = Dehydrator() spec_handler_cls = Mock() handlers_module.registry = {'simple': spec_handler_cls} spec = Mock(type='unknown') with raises(DehydrationException): dehydrator.select_handler(spec=spec)
def test_select_handler_found_in_registry(handlers_module): dehydrator = Dehydrator() spec_handler_cls = Mock() handlers_module.registry = {'simple': spec_handler_cls} spec = Mock(type='simple') dehydrator.select_handler(spec=spec) spec_handler_cls.assert_called_once_with(spec=spec, dehydrator=dehydrator)