1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/usr/bin/env python3
- import pytest
- from starlette.testclient import TestClient
- import json
-
- from pyheatpump.heatpump import app
-
-
- @pytest.mark.skip
- def test_get_(set_test_db):
- c = TestClient(app)
- r = c.get('/')
- assert r.status_code == 200
-
- resp = r.content.decode()
- assert isinstance(resp, str)
-
- d_resp = json.loads(resp)
- assert isinstance(d_resp, dict)
-
-
- def test_dict(set_db_values):
- c = TestClient(app)
- r = c.get('/')
- assert r.status_code == 200
-
- resp = r.content.decode()
- assert isinstance(resp, str)
-
- d_resp = json.loads(resp)
- assert isinstance(d_resp, dict)
-
- assert 'macAddress' in d_resp.keys()
- assert isinstance(d_resp['macAddress'], str)
- assert 'Analog' in d_resp.keys()
- assert isinstance(d_resp['Analog'], dict)
- assert 'Digital' in d_resp.keys()
- assert isinstance(d_resp['Digital'], dict)
- assert 'Integer' in d_resp.keys()
- assert isinstance(d_resp['Integer'], dict)
- int_keys = list(map(int, d_resp['Integer'].keys()))
- assert min(int_keys) == 1
- assert max(int_keys) == 1250
|