Skip to content

Commit 28d4414

Browse files
committed
Support for multiple pushes from last_push
1 parent 964e401 commit 28d4414

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

databox test/test_push.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def test_last_push(self):
4949

5050
assert self.client.last_push()['err'] == []
5151

52+
def test_last_push_with_number(self):
53+
self.client._push_json = lambda data=None, path='/': path
54+
assert self.client.last_push(3) == '/lastpushes/3'
55+
5256
def test_short(self):
5357
Client._push_json = mock_push_json
5458

databox/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def insert_all(self, rows):
6868
'data': [self.process_kpi(**row) for row in rows]
6969
})['status'] == 'ok'
7070

71-
def last_push(self):
72-
return self._push_json(path='/lastpushes/1')
71+
def last_push(self, number=1):
72+
return self._push_json(path='/lastpushes/{n}'.format(**{'n': number}))
7373

7474

7575
def push(key, value, date=None, token=None):

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
}},
3838
])
3939

40-
print client.last_push()
40+
print client.last_push(3)
4141

0 commit comments

Comments
 (0)