Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scuttle/versions/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def __init__(self, *args):
self.thread_posts_since = PaginatedMethod(
self._thread_posts_since, True
)
self.posts_since = PaginatedMethod(self._posts_since)
self.wikidotuser_pages = PaginatedMethod(self._wikidotuser_pages)
self.wikidotuser_posts = PaginatedMethod(self._wikidotuser_posts)
self.wikidotuser_revisions = PaginatedMethod(
Expand Down Expand Up @@ -210,6 +211,12 @@ def _thread_posts_since(self, thread_id: int, since: int, *, data):
raise TypeError("`since` must be a UNIX timestamp")
return [thread_id, since], data

@endpoint("post/since/{}")
def _posts_since(self, since: int, *, data=None):
if not isinstance(since, int):
raise TypeError("`since` must be a UNIX timestamp")
return [since], data

@endpoint("post/{}")
def post(self, post_id: int):
return [post_id], None
Expand Down
21 changes: 12 additions & 9 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,19 @@ def test_forums():
threads_since_then_gen = wiki.verbose(
wiki.forum_threads_since, forum_id, timestamp
)
for threads_since_then in threads_since_then_gen:
for thread in threads_since_then:
assert isinstance(thread['title'], str)
thread_id = thread['id']
posts_since_then_gen = wiki.verbose(
wiki.thread_posts_since, thread_id, timestamp
for thread in next(threads_since_then_gen):
assert isinstance(thread['title'], str)
thread_id = thread['id']
posts_in_thread_since_then_gen = wiki.verbose(
wiki.thread_posts_in_thread_since, thread_id, timestamp
)
for posts_since_then in posts_since_then_gen:
for post in posts_since_then:
assert isinstance(post['subject'], str)
for post in next(posts_in_thread_since_then_gen):
assert isinstance(post['subject'], str)
get_posts_since_then = wiki.posts_since(timestamp)
assert all('thread_id' in post for post in get_posts_since_then)
post_posts_since_then_gen = wiki.verbose(wiki.posts_since, timestamp)
for post in next(post_posts_since_then_gen):
assert isinstance(post['subject'], str)


def test_tags():
Expand Down