-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathtest_Read.py
51 lines (40 loc) · 1.7 KB
/
test_Read.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/BIn/env python
# -*- coding utf-8 -*-
from typing import AsyncGenerator
import pytest
"""
Test Bacnet communication with another device
"""
CHANGE_DELTA_AI = 99.90
CHANGE_DELTA_AO = 89.90
CHANGE_DELTA_AV = 79.90
TOLERANCE = 0.01
BINARY_TEST_STATE_STR1 = False
BINARY_TEST_STATE_STR2 = False
BINARY_TEST_STATE_BOOL = False
CHARACTERSTRINGVALUE = "test"
@pytest.mark.asyncio
async def test_ReadAnalog(network_and_devices: AsyncGenerator):
async for resources in network_and_devices:
loop, bacnet, device_app, device30_app, test_device, test_device_30 = resources
await test_device["AV"].value
assert (test_device["AV"].lastValue - CHANGE_DELTA_AV) < TOLERANCE
# assert not test_device["MSV"] == 1
assert test_device["BIG-ALARM"] == "Normal"
await test_device["AI"].value
assert (test_device["AI"].lastValue - CHANGE_DELTA_AI) < TOLERANCE
await test_device["AO"].value
assert (test_device["AO"].lastValue - CHANGE_DELTA_AO) < TOLERANCE
# assert test_device["CS_VALUE"] == CHARACTERSTRINGVALUE
@pytest.mark.asyncio
async def test_ReadBinary(network_and_devices: AsyncGenerator):
async for resources in network_and_devices:
loop, bacnet, device_app, device30_app, test_device, test_device_30 = resources
await test_device["BV-1"].value
# assert test_device["BV-1"] is False
print(test_device["BV-1"])
# assert test_device["BV-1"] == BINARY_TEST_STATE
# assert test_device["CS_VALUE"] == CHARACTERSTRINGVALUE
assert test_device["BI"] == BINARY_TEST_STATE_STR1
assert test_device["BO"] == BINARY_TEST_STATE_STR2
assert test_device["BO-1"] == BINARY_TEST_STATE_BOOL