Skip to content

Commit d4e803d

Browse files
committed
Add and test threads_since and posts_since
1 parent a1848b4 commit d4e803d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

scuttle/versions/v1.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,11 @@ def forum(self, forum_id: int):
192192
def forum_threads(self, forum_id: int):
193193
return [forum_id], None
194194

195-
@endpoint("forum/{}/since")
195+
@endpoint("forum/{}/since/{}")
196196
def _forum_threads_since(self, forum_id: int, since: int, *, data):
197197
if not isinstance(since, int):
198198
raise TypeError("`since` must be a UNIX timestamp")
199-
data['timestamp'] = since
200-
return [forum_id], data
199+
return [forum_id, since], data
201200

202201
@endpoint("thread/{}")
203202
def thread(self, thread_id: int):
@@ -207,11 +206,11 @@ def thread(self, thread_id: int):
207206
def _thread_posts(self, thread_id: int, *, data=None):
208207
return [thread_id], data
209208

210-
@endpoint("thread/{}/since")
209+
@endpoint("thread/{}/since/{}")
211210
def _thread_posts_since(self, thread_id: int, since: int, *, data):
212211
if not isinstance(since, int):
213212
raise TypeError("`since` must be a UNIX timestamp")
214-
return [thread_id], data
213+
return [thread_id, since], data
215214

216215
@endpoint("post/{}")
217216
def post(self, post_id: int):

test/test_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ def test_forums():
139139
for threads_since_then in threads_since_then_gen:
140140
for thread in threads_since_then:
141141
assert isinstance(thread['title'], str)
142+
thread_id = thread['id']
143+
posts_since_then_gen = wiki.verbose(
144+
wiki.thread_posts_since, thread_id, timestamp
145+
)
146+
for posts_since_then in posts_since_then_gen:
147+
for post in posts_since_then:
148+
assert isinstance(post['subject'], str)
142149

143150

144151

0 commit comments

Comments
 (0)