Projet de remplacement du "RPiPasserelle" d'Otec.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_heatpump.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env python3
  2. import pytest
  3. from starlette.testclient import TestClient
  4. import json
  5. from pyheatpump.heatpump import app
  6. @pytest.mark.skip
  7. def test_get_(set_test_db):
  8. c = TestClient(app)
  9. r = c.get('/')
  10. assert r.status_code == 200
  11. resp = r.content.decode()
  12. assert isinstance(resp, str)
  13. d_resp = json.loads(resp)
  14. assert isinstance(d_resp, dict)
  15. def test_dict(set_db_values):
  16. c = TestClient(app)
  17. r = c.get('/')
  18. assert r.status_code == 200
  19. resp = r.content.decode()
  20. assert isinstance(resp, str)
  21. d_resp = json.loads(resp)
  22. assert isinstance(d_resp, dict)
  23. assert 'macAddress' in d_resp.keys()
  24. assert isinstance(d_resp['macAddress'], str)
  25. assert 'Analog' in d_resp.keys()
  26. assert isinstance(d_resp['Analog'], dict)
  27. assert 'Digital' in d_resp.keys()
  28. assert isinstance(d_resp['Digital'], dict)
  29. assert 'Integer' in d_resp.keys()
  30. assert isinstance(d_resp['Integer'], dict)
  31. int_keys = list(map(int, d_resp['Integer'].keys()))
  32. assert min(int_keys) == 1
  33. assert max(int_keys) == 1250