Commit 6e1a56aa authored by olivier R-D's avatar olivier R-D

add tests for HistorySQL

parent 6d5ca772
......@@ -17,6 +17,8 @@ from tests_cmd_lines import TestCmdLines
from tests_server import TestServer
from tests_client import TestClient
from tests_unit import TestUnit
from tests_history import TestHistory
from tests_history import TestHistorySQL
if CRYPTOGRAPHY_AVAILABLE:
from tests_crypto_connect import TestCryptoConnect
......
......@@ -867,32 +867,3 @@ class CommonTests(object):
self.assertTrue(len(endpoints) > 0)
self.assertTrue(endpoints[0].EndpointUrl.startswith("opc.tcp://"))
def test_history_read(self):
o = self.srv.get_objects_node()
vals = [i for i in range(20)]
var = o.add_variable(3, "history_var", 0)
self.srv.iserver.enable_history(var, period=None, count=10)
for i in vals:
var.set_value(i)
time.sleep(1)
now = datetime.now()
old = now - timedelta(days=6)
res = var.read_raw_history(None, now, 2)
self.assertEqual(len(res), 2)
self.assertEqual(res[-1].Value.Value, vals[-1])
res = var.read_raw_history(old, now, 0)
self.assertEqual(len(res), 20)
self.assertEqual(res[-1].Value.Value, vals[-1])
self.assertEqual(res[0].Value.Value, vals[0])
res = var.read_raw_history(old, now, 5)
self.assertEqual(len(res), 5)
self.assertEqual(res[-1].Value.Value, vals[4])
self.assertEqual(res[0].Value.Value, vals[0])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment