Default rollback_on_shutdown to false in DatabaseMiddleware (#357)

This commit is contained in:
Henrik Ossipoff Hansen 2019-01-26 14:02:11 +01:00 committed by Tom Christie
parent d3a0a723a7
commit 678589b2de
2 changed files with 3 additions and 2 deletions

View File

@ -155,7 +155,8 @@ if TESTING:
DATABASE_URL = DATABASE_URL.replace(database='test_' + DATABASE_URL.database)
# Use 'rollback_on_shutdown' during testing, to ensure we have
# Use 'rollback_on_shutdown' during testing, to ensure we do not persist
# database changes
app = Starlette()
app.add_middleware(
DatabaseMiddleware,

View File

@ -16,7 +16,7 @@ class DatabaseMiddleware:
self,
app: ASGIApp,
database_url: typing.Union[str, DatabaseURL],
rollback_on_shutdown: bool,
rollback_on_shutdown: bool = False,
) -> None:
self.app = app
self.backend = self.get_backend(database_url)