Fix tests

merge-requests/8/head
Bob Mottram 2020-08-21 18:40:50 +01:00
parent 25e1724691
commit 1983f8935e
2 changed files with 31 additions and 19 deletions

View File

@ -166,6 +166,11 @@ parser.add_argument('--json', dest='json', type=str, default=None,
help='Show the json for a given activitypub url') help='Show the json for a given activitypub url')
parser.add_argument('-f', '--federate', nargs='+', dest='federationList', parser.add_argument('-f', '--federate', nargs='+', dest='federationList',
help='Specify federation list separated by spaces') 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='?', parser.add_argument("--noapproval", type=str2bool, nargs='?',
const=True, default=False, const=True, default=False,
help="Allow followers without approval") help="Allow followers without approval")
@ -829,7 +834,7 @@ if args.message:
domain, port, domain, port,
toNickname, toDomain, toPort, ccUrl, toNickname, toDomain, toPort, ccUrl,
httpPrefix, sendMessage, followersOnly, httpPrefix, sendMessage, followersOnly,
attach, mediaType, args.commentsEnabled, attach, mediaType,
attachedImageDescription, useBlurhash, attachedImageDescription, useBlurhash,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,
args.debug, replyTo, replyTo, subject) args.debug, replyTo, replyTo, subject)
@ -1751,30 +1756,30 @@ if args.testdata:
deleteAllPosts(baseDir, nickname, domain, 'outbox') deleteAllPosts(baseDir, nickname, domain, 'outbox')
createPublicPost(baseDir, nickname, domain, port, httpPrefix, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"like, this is totally just a #test, man", "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, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"Zoiks!!!", "Zoiks!!!",
False, True, False, None, None, useBlurhash) False, True, False, True, None, None, useBlurhash)
createPublicPost(baseDir, nickname, domain, port, httpPrefix, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"Hey scoob we need like a hundred more #milkshakes", "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, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"Getting kinda spooky around here", "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, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"And they would have gotten away with it too" + "And they would have gotten away with it too" +
"if it wasn't for those pesky hackers", "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) 'Description of image', useBlurhash)
createPublicPost(baseDir, nickname, domain, port, httpPrefix, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"man, these centralized sites are, like, the worst!", "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, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"another mystery solved #test", "another mystery solved #test",
False, True, False, None, None, useBlurhash) False, True, False, True, None, None, useBlurhash)
createPublicPost(baseDir, nickname, domain, port, httpPrefix, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"let's go bowling", "let's go bowling",
False, True, False, None, None, useBlurhash) False, True, False, True, None, None, useBlurhash)
domainFull = domain + ':' + str(port) domainFull = domain + ':' + str(port)
clearFollows(baseDir, nickname, domain) clearFollows(baseDir, nickname, domain)

View File

@ -270,14 +270,16 @@ def createServerAlice(path: str, domain: str, port: int,
clientToServer = False clientToServer = False
createPublicPost(path, nickname, domain, port, httpPrefix, createPublicPost(path, nickname, domain, port, httpPrefix,
"No wise fish would go anywhere without a porpoise", "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, createPublicPost(path, nickname, domain, port, httpPrefix,
"Curiouser and curiouser!", False, True, "Curiouser and curiouser!", False, True,
clientToServer, None, None, useBlurhash) clientToServer, True, None, None, useBlurhash)
createPublicPost(path, nickname, domain, port, httpPrefix, createPublicPost(path, nickname, domain, port, httpPrefix,
"In the gardens of memory, in the palace " + "In the gardens of memory, in the palace " +
"of dreams, that is where you and I shall meet", "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 global testServerAliceRunning
testServerAliceRunning = True testServerAliceRunning = True
maxMentions = 10 maxMentions = 10
@ -335,14 +337,17 @@ def createServerBob(path: str, domain: str, port: int,
if hasPosts: if hasPosts:
createPublicPost(path, nickname, domain, port, httpPrefix, createPublicPost(path, nickname, domain, port, httpPrefix,
"It's your life, live it your way.", "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, createPublicPost(path, nickname, domain, port, httpPrefix,
"One of the things I've realised is that " + "One of the things I've realised is that " +
"I am very simple", "I am very simple",
False, True, clientToServer, None, None, useBlurhash) False, True, clientToServer, True,
None, None, useBlurhash)
createPublicPost(path, nickname, domain, port, httpPrefix, createPublicPost(path, nickname, domain, port, httpPrefix,
"Quantum physics is a bit of a passion of mine", "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 global testServerBobRunning
testServerBobRunning = True testServerBobRunning = True
maxMentions = 10 maxMentions = 10
@ -503,7 +508,8 @@ def testPostMessageBetweenServers():
'Why is a mouse when it spins? ' + 'Why is a mouse when it spins? ' +
'यह एक परीक्षण है #sillyquestion', 'यह एक परीक्षण है #sillyquestion',
followersOnly, followersOnly,
saveToFile, clientToServer, attachedImageFilename, mediaType, saveToFile, clientToServer, True,
attachedImageFilename, mediaType,
attachedImageDescription, useBlurhash, federationList, attachedImageDescription, useBlurhash, federationList,
aliceSendThreads, alicePostLog, aliceCachedWebfingers, aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, inReplyTo, alicePersonCache, isArticle, inReplyTo,
@ -788,7 +794,8 @@ def testFollowBetweenServers():
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort, sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
'bob', bobDomain, bobPort, ccUrl, 'bob', bobDomain, bobPort, ccUrl,
httpPrefix, 'Alice message', followersOnly, saveToFile, httpPrefix, 'Alice message', followersOnly, saveToFile,
clientToServer, None, None, None, useBlurhash, federationList, clientToServer, True,
None, None, None, useBlurhash, federationList,
aliceSendThreads, alicePostLog, aliceCachedWebfingers, aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, inReplyTo, alicePersonCache, isArticle, inReplyTo,
inReplyToAtomUri, subject) inReplyToAtomUri, subject)
@ -1092,7 +1099,7 @@ def testCreatePerson():
archivePostsForPerson(nickname, domain, baseDir, 'outbox', None, {}, 4) archivePostsForPerson(nickname, domain, baseDir, 'outbox', None, {}, 4)
createPublicPost(baseDir, nickname, domain, port, httpPrefix, createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"G'day world!", False, True, clientToServer, "G'day world!", False, True, clientToServer,
None, None, useBlurhash, None, None, True, None, None, useBlurhash, None, None,
'Not suitable for Vogons') 'Not suitable for Vogons')
os.chdir(currDir) os.chdir(currDir)
@ -1315,7 +1322,7 @@ def testClientToServer():
aliceDomain, alicePort, aliceDomain, alicePort,
'bob', bobDomain, bobPort, None, 'bob', bobDomain, bobPort, None,
httpPrefix, 'Sent from my ActivityPub client', httpPrefix, 'Sent from my ActivityPub client',
followersOnly, followersOnly, True,
attachedImageFilename, mediaType, attachedImageFilename, mediaType,
attachedImageDescription, useBlurhash, attachedImageDescription, useBlurhash,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,