M test/conftest.py +5 -0
@@ 133,6 133,11 @@ def client(engine):
)
resp.add_callback(
+ responses.PUT, 'http://test-uri/series/strip',
+ callback=write_request_bridge(wsgitester.put)
+ )
+
+ resp.add_callback(
responses.GET, 'http://test-uri/series/insertion_dates',
callback=partial(read_request_bridge, wsgitester)
)
M test/test_api.py +14 -1
@@ 375,7 375,7 @@ 2015-01-02 00:00:00+00:00 2015-01-01 03
""", hist)
-def test_log(client):
+def test_log_strip(client):
series = genserie(utcdt(2020, 1, 1), 'D', 5)
for d in range(5):
res = client.update(
@@ 451,6 451,19 @@ 2020-01-05 00:00:00+00:00 4.0
'rev': 3}
]
+ client.strip('test-log', utcdt(2020, 1, 3))
+ log = client.log(
+ 'test-log',
+ fromdate=utcdt(2020, 1, 2),
+ todate=utcdt(2020, 1, 3)
+ )
+ assert log == [{
+ 'author': 'Babar',
+ 'date': pd.Timestamp('2020-01-02T00:00:00+00:00'),
+ 'meta': {'comment': 'day 2'},
+ 'rev': 2
+ }]
+
def test_formula(client, engine, tsh):
tsh.update(
M tshistory_client/api.py +12 -0
@@ 348,6 348,18 @@ class Client:
return res
@unwraperror
+ def strip(self, name, insertion_date):
+ res = requests.put(
+ f'{self.uri}/series/strip',
+ data={'name': name,
+ 'insertion_date': insertion_date}
+ )
+ if res.status_code == 204:
+ return
+
+ return res
+
+ @unwraperror
def delete(self, name):
res = requests.delete(
f'{self.uri}/series/state',