summaryrefslogtreecommitdiffstats
path: root/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py
diff options
context:
space:
mode:
authorEdi Feschiyan <553226+refresher@users.noreply.github.com>2020-06-18 13:12:31 +0300
committerEdi Feschiyan <553226+refresher@users.noreply.github.com>2020-06-18 13:12:31 +0300
commit80159d8789fe2ea0b36d84b83348813f67e18652 (patch)
treea997c5013257bdb7d02518d86c21595c15a33ced /templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py
parent8a8b87e65c0b3d579f8ea420e23a9cd07528dfe1 (diff)
Rearranging files for distribution, setup.py modifications
Diffstat (limited to 'templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py')
-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()