def test_includeme_session_correct_order(config): def register(): f = lambda: None config.registry.registerUtility(f, ISessionFactory) config.action(('pyramid_crud', 'session_test'), register) pyramid_crud.includeme(config) config.commit()
def test_includeme_session_wrong_order(config): def register(): f = lambda: None config.registry.registerUtility(f, ISessionFactory) config.action(('pyramid_crud', 'session_test'), register, order=2) pyramid_crud.includeme(config) with pytest.raises(ConfigurationError): config.commit()
def test_includeme_static_view_none(config, pyramid_request): pyramid_crud.includeme(config) config.commit() pyramid_request.static_url('pyramid_crud:static/test.png')
def test_includeme_static_view_default(config, pyramid_request): pyramid_crud.includeme(config) config.commit() url = pyramid_request.static_url('pyramid_crud:static/test.png') assert url == 'http://example.com/static/crud/test.png'
def test_includeme_no_session(config): pyramid_crud.includeme(config) with pytest.raises(ConfigurationError): config.commit()