Skip to content

Commit

Permalink
address comments and refactore code
Browse files Browse the repository at this point in the history
  • Loading branch information
devketanpro committed Feb 11, 2025
1 parent 6322856 commit c7af2c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 43 deletions.
12 changes: 6 additions & 6 deletions features/mgmt_api/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ def before_scenario(context, scenario):
return

try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(before_scenario_async(context, scenario))
loop = asyncio.get_event_loop()
loop.run_until_complete(before_scenario_async(context, scenario))
except Exception as e:
# Make sure exceptions raised are printed to the console
logger.exception(e)
raise e


async def before_scenario_async(context, scenario):
Expand All @@ -53,7 +54,6 @@ async def before_scenario_async(context, scenario):
"MGMT_API_ENABLED": True,
"AUTH_SERVER_SHARED_SECRET": "test-secret",
"CACHE_TYPE": "null",
"ASYNC_AUTH_CLASS": "newsroom.mgmt_api.auth.jwt:JWTTokenAuth",
}

context.app = get_app(config=config)
Expand Down
2 changes: 2 additions & 0 deletions newsroom/mgmt_api/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(self, import_name=__package__, config=None, **kwargs):
# So if we're running behave tests, reset this config here
config["INSTALLED_APPS"] = []

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

super(NewsroomMGMTAPI, self).__init__(import_name=import_name, config=config, **kwargs)
Expand Down
36 changes: 0 additions & 36 deletions newsroom/mgmt_api/utils.py

This file was deleted.

1 change: 0 additions & 1 deletion newsroom/web/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
"newsroom.email_templates",
"newsroom.search",
"newsroom.notifications.commands",
"newsroom.mgmt_api",
]

ASYNC_AUTH_CLASS = "newsroom.auth.session_auth:NewshubSessionAuth"
Expand Down

0 comments on commit c7af2c6

Please sign in to comment.