Skip to content

Commit

Permalink
Fixes crash when running API v2 tests
Browse files Browse the repository at this point in the history
Jinja templates where not initialized in the test server.
  • Loading branch information
jean-baptiste-perez-bib committed Jul 6, 2024
1 parent aa46583 commit c2f6f5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import os.path

import jinja2
import pytest
import random
import string
Expand All @@ -14,8 +15,8 @@
from unittest import mock
from aiohttp_apispec import validation_middleware
from aiohttp import web
import aiohttp_jinja2
from pathlib import Path

from app.api.v2.handlers.agent_api import AgentApi
from app.api.v2.handlers.ability_api import AbilityApi
from app.api.v2.handlers.objective_api import ObjectiveApi
Expand Down Expand Up @@ -392,6 +393,10 @@ async def initialize():
)
app_svc.application.middlewares.append(apispec_request_validation_middleware)
app_svc.application.middlewares.append(validation_middleware)
templates = ['plugins/%s/templates' % p.lower() for p in app_svc.get_config('plugins')]
templates.append('plugins/magma/dist')
templates.append("templates")
aiohttp_jinja2.setup(app_svc.application, loader=jinja2.FileSystemLoader(templates))
return app_svc

app_svc = await initialize()
Expand Down

0 comments on commit c2f6f5f

Please sign in to comment.