Skip to content

Commit

Permalink
Add test_insert_datapoint_with_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
dougthor42 committed Mar 4, 2019
1 parent ae401f1 commit c32d7b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ def test_insert_datapoint(app, populated_db):
assert len(new) == 1


def test_insert_datapoint_with_timestamp(app, populated_db):
ts = 1546532070
rv = db.insert_datapoint("empty_metric", 15, ts)
assert rv.metric.metric_id == 1
assert rv.value == 15
assert isinstance(rv.timestamp, (int, float))

new = db.DataPoint.select().where(db.DataPoint.metric_id == 1)
assert len(new) == 1
expected = _naive_utc_dt_from_posix_ts(ts)
assert new[0].timestamp == expected


def test_get_data(app, populated_db):
rv = db.get_data("empty_metric")
assert len(rv) == 0
Expand Down

0 comments on commit c32d7b3

Please sign in to comment.