blob: d09f443bcbd64f3ae769c56363259e7691c72d8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import asyncio
import os
import pytest
import logging
from pyagl.services.base import AFBResponse, AFBT
from concurrent.futures import TimeoutError
from pyagl.services.nfc import NFCService as nfcs
pytestmark = pytest.mark.asyncio
@pytest.fixture(scope='module')
def event_loop():
loop = asyncio.get_event_loop()
yield loop
@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 nfcs(ip=address, port=port)
yield svc
await svc.websocket.close()
async def subscribe(event_loop, service: nfcs):
msgid = service.subscribe()
resp = await service.afbresponse()
assert resp.msgid == msgid
async def unsubscribe(event_loop, service: nfcs):
msgid = service.unsubscribe()
resp = await service.afbresponse()
assert resp.msgid == msgid
|