[wip] [get][post] /config/last_update
This commit is contained in:
parent
39d59badde
commit
ca4849b2c7
3 changed files with 56 additions and 3 deletions
|
|
@ -2,13 +2,17 @@
|
|||
import pytest
|
||||
from starlette.authentication import UnauthenticatedUser
|
||||
from starlette.testclient import TestClient
|
||||
from pyheatpump.config import app, config, default_config, CONFIG_FILES, get_config, set_config, config_route, ROUTES, mac_address_init, save_config
|
||||
from pyheatpump.config import app, config, default_config, \
|
||||
CONFIG_FILES, get_config, set_config, config_route, ROUTES, \
|
||||
mac_address_init, save_config, get_last_update, set_last_update, \
|
||||
last_update_route
|
||||
from unittest.mock import patch, MagicMock
|
||||
from pprint import pprint
|
||||
import json
|
||||
from tempfile import mkstemp
|
||||
from configparser import ConfigParser
|
||||
import os
|
||||
from requests import Request
|
||||
|
||||
@pytest.fixture
|
||||
def tmpconf(testdir):
|
||||
|
|
@ -75,3 +79,15 @@ def test_mac_address(testdir, tmpconf):
|
|||
assert config_mac_address == mac_address
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_last_update(testdir, tmpconf):
|
||||
req = Request()
|
||||
req.method = 'POST'
|
||||
res = await last_update_route(req)
|
||||
last_update_0 = int(res.body)
|
||||
|
||||
res = await get_last_update(req)
|
||||
last_update_1 = int(res.body)
|
||||
assert last_update_0 == last_update_1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue