[tests] update tests for last commit
This commit is contained in:
parent
55c943c149
commit
c07b7f8005
4 changed files with 28 additions and 7 deletions
|
|
@ -7,7 +7,7 @@ INSERT INTO var_value (type, address, value, time) VALUES
|
|||
('A', 15, 10024, strftime('%s', 'now')),
|
||||
('A', 16, 24000, strftime('%s', datetime('now', '-1 hours'))),
|
||||
('A', 17, 36000, strftime('%s', datetime('now', '-1 days'))),
|
||||
('A', 10, 0, strftime('%s', datetime('now', '-2 days'))),
|
||||
('I', 5002, 101, strftime('%s', datetime('now'))),
|
||||
('I', 5010, 42, strftime('%s', datetime('now'))),
|
||||
('I', 5011, 24, strftime('%s', datetime('now'))),
|
||||
('I', 5010, 20, strftime('%s', datetime('now', '-1 hours'))),
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@ INSERT INTO variable (type, address, unit) VALUES
|
|||
('A', 11, 'deg'),
|
||||
('A', 12, 'deg'),
|
||||
('A', 13, 'deg'),
|
||||
('A', 14, 'deg'),
|
||||
('A', 15, 'deg'),
|
||||
('A', 16, 'deg'),
|
||||
('A', 17, 'deg'),
|
||||
('I', 5002, 'deg'),
|
||||
('I', 5010, 'deg'),
|
||||
('I', 5011, 'deg'),
|
||||
('I', 5012, 'deg'),
|
||||
('I', 5013, 'deg'),
|
||||
('D', 10, 'bit'),
|
||||
('D', 11, 'bit'),
|
||||
('D', 12, 'bit'),
|
||||
('D', 13, 'bit');
|
||||
('D', 13, 'bit'),
|
||||
('D', 14, 'bit');
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ def set_test_db():
|
|||
|
||||
yield
|
||||
|
||||
os.unlink(tmpdb)
|
||||
#os.unlink(tmpdb)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import json
|
|||
from pyheatpump.heatpump import app
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_get_(set_test_db):
|
||||
c = TestClient(app)
|
||||
r = c.get('/')
|
||||
|
|
@ -27,6 +26,7 @@ def test_dict(set_test_db):
|
|||
resp = r.content.decode()
|
||||
assert isinstance(resp, str)
|
||||
|
||||
print(resp)
|
||||
d_resp = json.loads(resp)
|
||||
assert isinstance(d_resp, dict)
|
||||
print(d_resp)
|
||||
|
|
@ -35,11 +35,28 @@ def test_dict(set_test_db):
|
|||
assert isinstance(d_resp['macAddress'], str)
|
||||
assert 'Analog' in d_resp.keys()
|
||||
assert isinstance(d_resp['Analog'], dict)
|
||||
int_keys = list(map(int, d_resp['Analog'].keys()))
|
||||
assert min(int_keys) == 10
|
||||
assert max(int_keys) == 17
|
||||
assert d_resp['Analog']['10'] == 4.2
|
||||
assert d_resp['Analog']['17'] == -2953.6
|
||||
|
||||
assert 'Digital' in d_resp.keys()
|
||||
assert isinstance(d_resp['Digital'], dict)
|
||||
int_keys = list(map(int, d_resp['Digital'].keys()))
|
||||
assert min(int_keys) == 10
|
||||
assert max(int_keys) == 14
|
||||
|
||||
assert d_resp['Digital']['10'] == False
|
||||
assert d_resp['Digital']['14'] == True
|
||||
|
||||
assert 'Integer' in d_resp.keys()
|
||||
assert isinstance(d_resp['Integer'], dict)
|
||||
int_keys = list(map(int, d_resp['Integer'].keys()))
|
||||
print(int_keys)
|
||||
assert min(int_keys) == 1
|
||||
assert max(int_keys) == 2
|
||||
assert max(int_keys) == 10
|
||||
|
||||
assert d_resp['Integer']['1'] == 101
|
||||
assert d_resp['Integer']['10'] == 24
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue