From 1983f8935e29fb334db7f6d6118c718dfc502091 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 21 Aug 2020 18:40:50 +0100 Subject: [PATCH] Fix tests --- epicyon.py | 23 ++++++++++++++--------- tests.py | 27 +++++++++++++++++---------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/epicyon.py b/epicyon.py index c7809ecbd..a1915c138 100644 --- a/epicyon.py +++ b/epicyon.py @@ -166,6 +166,11 @@ parser.add_argument('--json', dest='json', type=str, default=None, help='Show the json for a given activitypub url') parser.add_argument('-f', '--federate', nargs='+', dest='federationList', help='Specify federation list separated by spaces') +parser.add_argument("--repliesEnabled", "--commentsEnabled", + dest='commentsEnabled', + type=str2bool, nargs='?', + const=True, default=True, + help="Enable replies to a post") parser.add_argument("--noapproval", type=str2bool, nargs='?', const=True, default=False, help="Allow followers without approval") @@ -829,7 +834,7 @@ if args.message: domain, port, toNickname, toDomain, toPort, ccUrl, httpPrefix, sendMessage, followersOnly, - attach, mediaType, + args.commentsEnabled, attach, mediaType, attachedImageDescription, useBlurhash, cachedWebfingers, personCache, isArticle, args.debug, replyTo, replyTo, subject) @@ -1751,30 +1756,30 @@ if args.testdata: deleteAllPosts(baseDir, nickname, domain, 'outbox') createPublicPost(baseDir, nickname, domain, port, httpPrefix, "like, this is totally just a #test, man", - False, True, False, None, None, useBlurhash) + False, True, False, True, None, None, useBlurhash) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "Zoiks!!!", - False, True, False, None, None, useBlurhash) + False, True, False, True, None, None, useBlurhash) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "Hey scoob we need like a hundred more #milkshakes", - False, True, False, None, None, useBlurhash) + False, True, False, True, None, None, useBlurhash) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "Getting kinda spooky around here", - False, True, False, None, None, useBlurhash, 'someone') + False, True, False, True, None, None, useBlurhash, 'someone') createPublicPost(baseDir, nickname, domain, port, httpPrefix, "And they would have gotten away with it too" + "if it wasn't for those pesky hackers", - False, True, False, 'img/logo.png', + False, True, False, True, 'img/logo.png', 'Description of image', useBlurhash) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "man, these centralized sites are, like, the worst!", - False, True, False, None, None, useBlurhash) + False, True, False, True, None, None, useBlurhash) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "another mystery solved #test", - False, True, False, None, None, useBlurhash) + False, True, False, True, None, None, useBlurhash) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "let's go bowling", - False, True, False, None, None, useBlurhash) + False, True, False, True, None, None, useBlurhash) domainFull = domain + ':' + str(port) clearFollows(baseDir, nickname, domain) diff --git a/tests.py b/tests.py index f7a27aaa3..b6ac4239b 100644 --- a/tests.py +++ b/tests.py @@ -270,14 +270,16 @@ def createServerAlice(path: str, domain: str, port: int, clientToServer = False createPublicPost(path, nickname, domain, port, httpPrefix, "No wise fish would go anywhere without a porpoise", - False, True, clientToServer, None, None, useBlurhash) + False, True, clientToServer, True, + None, None, useBlurhash) createPublicPost(path, nickname, domain, port, httpPrefix, "Curiouser and curiouser!", False, True, - clientToServer, None, None, useBlurhash) + clientToServer, True, None, None, useBlurhash) createPublicPost(path, nickname, domain, port, httpPrefix, "In the gardens of memory, in the palace " + "of dreams, that is where you and I shall meet", - False, True, clientToServer, None, None, useBlurhash) + False, True, clientToServer, True, + None, None, useBlurhash) global testServerAliceRunning testServerAliceRunning = True maxMentions = 10 @@ -335,14 +337,17 @@ def createServerBob(path: str, domain: str, port: int, if hasPosts: createPublicPost(path, nickname, domain, port, httpPrefix, "It's your life, live it your way.", - False, True, clientToServer, None, None, useBlurhash) + False, True, clientToServer, True, + None, None, useBlurhash) createPublicPost(path, nickname, domain, port, httpPrefix, "One of the things I've realised is that " + "I am very simple", - False, True, clientToServer, None, None, useBlurhash) + False, True, clientToServer, True, + None, None, useBlurhash) createPublicPost(path, nickname, domain, port, httpPrefix, "Quantum physics is a bit of a passion of mine", - False, True, clientToServer, None, None, useBlurhash) + False, True, clientToServer, True, + None, None, useBlurhash) global testServerBobRunning testServerBobRunning = True maxMentions = 10 @@ -503,7 +508,8 @@ def testPostMessageBetweenServers(): 'Why is a mouse when it spins? ' + 'यह एक परीक्षण है #sillyquestion', followersOnly, - saveToFile, clientToServer, attachedImageFilename, mediaType, + saveToFile, clientToServer, True, + attachedImageFilename, mediaType, attachedImageDescription, useBlurhash, federationList, aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, isArticle, inReplyTo, @@ -788,7 +794,8 @@ def testFollowBetweenServers(): sessionAlice, aliceDir, 'alice', aliceDomain, alicePort, 'bob', bobDomain, bobPort, ccUrl, httpPrefix, 'Alice message', followersOnly, saveToFile, - clientToServer, None, None, None, useBlurhash, federationList, + clientToServer, True, + None, None, None, useBlurhash, federationList, aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, isArticle, inReplyTo, inReplyToAtomUri, subject) @@ -1092,7 +1099,7 @@ def testCreatePerson(): archivePostsForPerson(nickname, domain, baseDir, 'outbox', None, {}, 4) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "G'day world!", False, True, clientToServer, - None, None, useBlurhash, None, None, + True, None, None, useBlurhash, None, None, 'Not suitable for Vogons') os.chdir(currDir) @@ -1315,7 +1322,7 @@ def testClientToServer(): aliceDomain, alicePort, 'bob', bobDomain, bobPort, None, httpPrefix, 'Sent from my ActivityPub client', - followersOnly, + followersOnly, True, attachedImageFilename, mediaType, attachedImageDescription, useBlurhash, cachedWebfingers, personCache, isArticle,