summaryrefslogtreecommitdiffstats
path: root/templates/{{cookiecutter.tests_dir}}
diff options
context:
space:
mode:
Diffstat (limited to 'templates/{{cookiecutter.tests_dir}}')
-rw-r--r--templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py b/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py
new file mode 100644
index 0000000..e193205
--- /dev/null
+++ b/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py
@@ -0,0 +1,23 @@
+import asyncio
+import os
+import pytest
+import logging
+from pyagl.services.base import AFBResponse, AFBT
+from concurrent.futures import TimeoutError
+
+from pyagl.services.{{cookiecutter.service_slug}} import {{cookiecutter.classname}}
+pytestmark = pytest.mark.asyncio
+
+@pytest.fixture(scope='module')
+def event_loop():
+ loop = asyncio.get_event_loop()
+ yield loop
+ loop.close()
+
+@pytest.fixture(scope='module')
+async def service():
+ address = os.environ.get('AGL_TGT_IP', 'localhost')
+ port = os.environ.get('AGL_TGT_PORT', None)
+ svc = await {{cookiecutter.classname}}(ip=address, port=port)
+ yield svc
+ await svc.websocket.close()