def create_depthseries(self): tso = dto.TimeSeries(DS_NAME) tso2 = dto.TimeSeries(DS2_NAME) try: res = depthseries.post_depth_series([tso2, tso]) except: pass yield depthseries.get_depthseries(prefix=DS_NAME) try: depthseries.delete_depth_series(DS_NAME) depthseries.delete_depth_series(DS2_NAME) except: pass
def test_create_series(self): prefix = ["one", "two", "three"] stage = ["stageone", "stagetwo"] stage1 = [] stage2 = [] for pre in prefix: stage1.append(";".join([pre, stage[0], DS_NAME])) stage2.append(";".join([pre, stage[1], DS_NAME])) stage1tso = [dto.TimeSeries(t) for t in stage1] stage2tso = [dto.TimeSeries(t) for t in stage2] res = depthseries.post_depth_series(stage1tso) assert res == {} res = depthseries.post_depth_series(stage1tso + stage2tso) assert res == {} try: for ds in stage1 + stage2: depthseries.delete_depth_series(ds) except: pass
def test_depthseries_unit_correct(self): tso = dto.TimeSeries(DS_NAME, unit="celsius") res = depthseries.update_depth_series([tso]) series = depthseries.get_depthseries(prefix=DS_NAME) assert series.to_json()[0]["unit"] == "celsius" assert series.to_json()[1]["unit"] == "m"
def test_update_timeseries(self): tso = dto.TimeSeries(DS_NAME, unit="celsius") res = depthseries.update_depth_series([tso]) assert res == {}
def datapoints_fixture(): tso = dto.TimeSeries(TS_NAME) timeseries.post_time_series([tso]) yield timeseries.delete_time_series(TS_NAME)
def test_post_timeseries(self): tso = dto.TimeSeries(TS_NAME) res = timeseries.post_time_series([tso]) assert res == {}