[tests] fix tests for last commit

This commit is contained in:
Maxime Alves LIRMM@home 2020-12-16 04:35:20 +01:00
commit 9b68062615
2 changed files with 7 additions and 7 deletions

View file

@ -15,7 +15,7 @@ def set_test_db():
_, tmpdb = mkstemp(suffix='.db', dir=os.getcwd(), )
print(f'Will store database in {tmpdb}')
config['heatpump']['database'] = tmpdb
assert DB.initialize(os.path.join(os.getcwd(), 'db/pyheatpump.sql'))
assert DB.initialize(os.path.join(os.getcwd(), './db/pyheatpump.sql'))
DB.sqlf(os.path.join(os.getcwd(), 'db/test_variables.sql'))
@ -31,7 +31,7 @@ def set_test_db():
@pytest.fixture(scope="module")
def set_db_values():
_, tmpdb = mkstemp(suffix='.db', dir=os.getcwd(), )
db_file = "./db/prod-b827ebbcab83-20201206.db"
db_file = "./db/pyheatpump.db"
shutil.copy(db_file, tmpdb)
config['heatpump']['database'] = tmpdb

View file

@ -31,14 +31,14 @@ def test_var_value_getval(set_test_db, var_types):
continue
time = datetime.fromtimestamp(variable.last_update)
value = VariableValue.get(variable.type,
value = VariableValue.get(var_type,
variable.address,
time).get_value()
assert type(value) == float
except StopIteration:
assert False
"""
var_type = var_types['Integer']
for _, variable in var_type.get_variables().items():
try:
@ -46,14 +46,13 @@ def test_var_value_getval(set_test_db, var_types):
continue
time = datetime.fromtimestamp(variable.last_update)
value = VariableValue.get(variable.type,
value = VariableValue.get(var_type,
variable.address,
time).get_value()
assert type(value) == int
except StopIteration:
assert False
var_type = var_types['Digital']
for _, variable in var_type.get_variables().items():
try:
@ -61,10 +60,11 @@ def test_var_value_getval(set_test_db, var_types):
continue
time = datetime.fromtimestamp(variable.last_update)
value = VariableValue.get(variable.type,
value = VariableValue.get(var_type,
variable.address,
time).get_value()
assert type(value) == bool
except StopIteration:
assert False
"""