Skip to content

Commit

Permalink
Move test-only config to corresponding fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
nabla-c0d3 authored Nov 13, 2021
1 parent 194797f commit 8f3c8e5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions securedrop/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def alembic_config(config: SDConfig) -> str:

@pytest.fixture(scope='function')
def source_app(config: SDConfig) -> Generator[Flask, None, None]:
config.SOURCE_APP_FLASK_CONFIG_CLS.TESTING = True
# Disable CSRF checks to make writing tests easier
config.SOURCE_APP_FLASK_CONFIG_CLS.WTF_CSRF_ENABLED = False

app = create_source_app(config)
app.config['SERVER_NAME'] = 'localhost.localdomain'
with app.app_context():
Expand All @@ -209,6 +213,10 @@ def source_app(config: SDConfig) -> Generator[Flask, None, None]:

@pytest.fixture(scope='function')
def journalist_app(config: SDConfig) -> Generator[Flask, None, None]:
config.JOURNALIST_APP_FLASK_CONFIG_CLS.TESTING = True
# Disable CSRF checks to make writing tests easier
config.JOURNALIST_APP_FLASK_CONFIG_CLS.WTF_CSRF_ENABLED = False

app = create_journalist_app(config)
app.config['SERVER_NAME'] = 'localhost.localdomain'
with app.app_context():
Expand Down

0 comments on commit 8f3c8e5

Please sign in to comment.