def test_load_sql_backend(self): """ keyword 'sql' loads SQLBackend """ config = MagicMock() config.get_settings.return_value = { 'auth.db.url': 'sqlite://', 'pypi.auth': 'sql', } includeme(config) config.add_request_method.assert_called_with( PartialEq(SQLAccessBackend), name='access', reify=True)
def test_load_arbitrary_backend(self): """ Can pass dotted path to load arbirary backend """ config = MagicMock() config.get_settings.return_value = { 'auth.db.url': 'sqlite://', 'pypi.auth': 'pypicloud.access.sql.SQLAccessBackend', } includeme(config) config.add_request_method.assert_called_with( PartialEq(SQLAccessBackend), name='access', reify=True)
def test_load_remote_backend(self): """ keyword 'remote' loads RemoteBackend """ config = MagicMock() config.get_settings.return_value = { 'pypi.auth': 'remote', 'auth.backend_server': 'http://example.com', } includeme(config) config.add_request_method.assert_called_with( PartialEq(RemoteAccessBackend), name='access', reify=True)