Skip to content

Commit c7af2c6

Browse files
committed
address comments and refactore code
1 parent 6322856 commit c7af2c6

File tree

4 files changed

+8
-43
lines changed

4 files changed

+8
-43
lines changed

features/mgmt_api/environment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ def before_scenario(context, scenario):
3636
return
3737

3838
try:
39-
loop = asyncio.get_running_loop()
40-
except RuntimeError:
41-
loop = asyncio.new_event_loop()
42-
asyncio.set_event_loop(loop)
43-
loop.run_until_complete(before_scenario_async(context, scenario))
39+
loop = asyncio.get_event_loop()
40+
loop.run_until_complete(before_scenario_async(context, scenario))
41+
except Exception as e:
42+
# Make sure exceptions raised are printed to the console
43+
logger.exception(e)
44+
raise e
4445

4546

4647
async def before_scenario_async(context, scenario):
@@ -53,7 +54,6 @@ async def before_scenario_async(context, scenario):
5354
"MGMT_API_ENABLED": True,
5455
"AUTH_SERVER_SHARED_SECRET": "test-secret",
5556
"CACHE_TYPE": "null",
56-
"ASYNC_AUTH_CLASS": "newsroom.mgmt_api.auth.jwt:JWTTokenAuth",
5757
}
5858

5959
context.app = get_app(config=config)

newsroom/mgmt_api/factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def __init__(self, import_name=__package__, config=None, **kwargs):
3939
# So if we're running behave tests, reset this config here
4040
config["INSTALLED_APPS"] = []
4141

42+
# Assigns the instance to `self.wsgi` to ensure compatibility with code
43+
# that expects `app.wsgi`, such as `config_oauth` and OAuth initialization.
4244
self.wsgi = self
4345

4446
super(NewsroomMGMTAPI, self).__init__(import_name=import_name, config=config, **kwargs)

newsroom/mgmt_api/utils.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

newsroom/web/default_settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
"newsroom.email_templates",
145145
"newsroom.search",
146146
"newsroom.notifications.commands",
147-
"newsroom.mgmt_api",
148147
]
149148

150149
ASYNC_AUTH_CLASS = "newsroom.auth.session_auth:NewshubSessionAuth"

0 commit comments

Comments
 (0)