Skip to content

Commit

Permalink
Update replies test to include recursive replies
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelOtter committed Oct 22, 2023
1 parent 30c7294 commit c3f58a7
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions granary/tests/test_bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,14 @@
THREAD_AS = copy.deepcopy(POST_AS)
THREAD_REPLY_AS = copy.deepcopy(REPLY_AS['object'])
THREAD_REPLY_AS['id'] = 'tag:bsky.app:at://did/app.bsky.feed.post/tid'
THREAD_AS['object']['replies'] = {'items': [THREAD_REPLY_AS]}
THREAD_REPLY2_AS = copy.deepcopy(REPLY_AS['object'])
THREAD_REPLY2_AS['id'] = 'tag:bsky.app:at://did/app.bsky.feed.post/tid2'
THREAD_REPLY2_AS['url'] = 'https://bsky.app/profile/did/post/tid2'
THREAD_REPLY2_AS['inReplyTo'] = [{
'id': 'at://did/app.bsky.feed.post/tid',
'url': 'https://bsky.app/profile/did/post/tid'
}]
THREAD_AS['object']['replies'] = {'items': [THREAD_REPLY_AS, THREAD_REPLY2_AS]}
THREAD_AS['object']['author'] = ACTOR_AS
THREAD_AS['object']['author'].update({
'username': 'alice.com',
Expand All @@ -298,17 +305,29 @@
'url': 'https://bsky.app/profile/alice.com',
})

THREAD_REPLY_BSKY = {
'$type': 'app.bsky.feed.defs#threadViewPost',
'post': copy.deepcopy(REPLY_POST_VIEW_BSKY),
'replies': [],
}

THREAD_BSKY = {
'$type': 'app.bsky.feed.defs#threadViewPost',
'post': POST_AUTHOR_BSKY,
'replies': [THREAD_REPLY_BSKY],
'replies': [{
'$type': 'app.bsky.feed.defs#threadViewPost',
'post': copy.deepcopy(REPLY_POST_VIEW_BSKY),
'replies': [{
'$type': 'app.bsky.feed.defs#threadViewPost',
'post': copy.deepcopy(REPLY_POST_VIEW_BSKY),
'replies': [],
}],
}],
}
THREAD_BSKY['replies'][0]['replies'][0]['post'].update({
'uri': 'at://did/app.bsky.feed.post/tid2'
})
THREAD_BSKY['replies'][0]['replies'][0]['post']['record']['reply'].update({
'parent': {
'$type': 'com.atproto.repo.strongRef',
'uri': 'at://did/app.bsky.feed.post/tid',
'cid': 'TODO'
}
})

BLOB = {
'$type': 'blob',
Expand Down

0 comments on commit c3f58a7

Please sign in to comment.