Test that group creates an outbox post

merge-requests/30/head
Bob Mottram 2021-09-18 11:12:07 +01:00
parent 4f446dd48a
commit 1afbe7e6f6
1 changed files with 21 additions and 9 deletions

View File

@ -2297,6 +2297,21 @@ def testGroupFollow(baseDir: str) -> None:
city = 'London, England' city = 'London, England'
lowBandwidth = False lowBandwidth = False
signingPrivateKeyPem = None signingPrivateKeyPem = None
queuePath = \
testgroupDir + '/accounts/testgroup@' + testgroupDomain + '/queue'
inboxPath = \
testgroupDir + '/accounts/testgroup@' + testgroupDomain + '/inbox'
outboxPath = \
testgroupDir + '/accounts/testgroup@' + testgroupDomain + '/outbox'
aliceMessageArrived = False
startPostsInbox = \
len([name for name in os.listdir(inboxPath)
if os.path.isfile(os.path.join(inboxPath, name))])
startPostsOutbox = \
len([name for name in os.listdir(outboxPath)
if os.path.isfile(os.path.join(outboxPath, name))])
sendResult = \ sendResult = \
sendPost(signingPrivateKeyPem, __version__, sendPost(signingPrivateKeyPem, __version__,
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort, sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
@ -2311,20 +2326,17 @@ def testGroupFollow(baseDir: str) -> None:
inReplyTo, inReplyToAtomUri, subject) inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
queuePath = \
testgroupDir + '/accounts/testgroup@' + testgroupDomain + '/queue'
inboxPath = \
testgroupDir + '/accounts/testgroup@' + testgroupDomain + '/inbox'
aliceMessageArrived = False
startPosts = len([name for name in os.listdir(inboxPath)
if os.path.isfile(os.path.join(inboxPath, name))])
for i in range(20): for i in range(20):
time.sleep(1) time.sleep(1)
if os.path.isdir(inboxPath): if os.path.isdir(inboxPath):
currPosts = \ currPostsInbox = \
len([name for name in os.listdir(inboxPath) len([name for name in os.listdir(inboxPath)
if os.path.isfile(os.path.join(inboxPath, name))]) if os.path.isfile(os.path.join(inboxPath, name))])
if currPosts > startPosts: currPostsOutbox = \
len([name for name in os.listdir(outboxPath)
if os.path.isfile(os.path.join(outboxPath, name))])
if currPostsInbox > startPostsInbox and \
currPostsOutbox > startPostsOutbox:
aliceMessageArrived = True aliceMessageArrived = True
print('Alice post sent to test group!') print('Alice post sent to test group!')
break break