diff --git a/data/605da6f41f58b122f41283823a99faa36286961a106ac901bb2b2d730fddc778 b/data/605da6f41f58b122f41283823a99faa36286961a106ac901bb2b2d730fddc778 new file mode 100644 index 0000000..86097c7 --- /dev/null +++ b/data/605da6f41f58b122f41283823a99faa36286961a106ac901bb2b2d730fddc778 @@ -0,0 +1,11 @@ +{"description": {"fstype": "tmpfs", "hostname": "ehoiai.int.wsr.at", "measure": "time_until_disk_full", "mountpoint": "/run/user/1054", "node": "rorschach.hjp.at", "remote_addr": "", "unit": "s"}, +"data": [ + [1674806402.1014915, 1000000000.0], + [1674814201.3452954, 1000000000.0], + [1675164602.4004557, 1000000000.0], + [1675165201.6291275, 1000000000.0], + [1675165802.2402072, 1000000000.0], + [1675166401.542857, 1000000000.0], + [1675167002.2809808, 1000000000.0], + [1675167601.2632012, 1000000000.0], + [1675168201.8321788, 1000000000.0]]} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0958717 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.pytest.ini_options] +pythonpath = "." + diff --git a/tests/__init__,py b/tests/__init__,py new file mode 100644 index 0000000..e69de29 diff --git a/tests/__pycache__/test_timeseries.cpython-39-pytest-7.2.1.pyc b/tests/__pycache__/test_timeseries.cpython-39-pytest-7.2.1.pyc new file mode 100644 index 0000000..e83340d Binary files /dev/null and b/tests/__pycache__/test_timeseries.cpython-39-pytest-7.2.1.pyc differ diff --git a/tests/test_timeseries.py b/tests/test_timeseries.py new file mode 100644 index 0000000..a9c498b --- /dev/null +++ b/tests/test_timeseries.py @@ -0,0 +1,28 @@ +import pytest + +from dashboard import TimeSeries + +def test_timeseries_1(): + data = {"description": {"fstype": "tmpfs", "hostname": "ehoiai.int.wsr.at", "measure": "time_until_disk_full", "mountpoint": "/run/user/1054", "node": "rorschach.hjp.at", "remote_addr": "", "unit": "s"}, + "data": [ + [1674806402.1014915, 1000000000.0], + [1674814201.3452954, 1000000000.0], + [1675164602.4004557, 1000000000.0], + [1675165201.6291275, 1000000000.0], + [1675165802.2402072, 1000000000.0], + [1675166401.542857, 1000000000.0], + [1675167002.2809808, 1000000000.0], + [1675167601.2632012, 1000000000.0], + [1675168201.8321788, 1000000000.0]]} + config = { + "type": "timeseries", + "multi": True, + "stops": [ 2592000, 604800, 86400 ], + "data": [ + "605da6f41f58b122f41283823a99faa36286961a106ac901bb2b2d730fddc778" + ], + "yscale": "log", + } + ts = TimeSeries(config) + graph = ts.graph + assert graph