mirror of https://gitlab.com/bashrc2/epicyon
Fix public post tests
parent
09c3703ba4
commit
9003ae187d
56
epicyon.py
56
epicyon.py
|
@ -2310,6 +2310,14 @@ if args.testdata:
|
||||||
testMediaType = None
|
testMediaType = None
|
||||||
testImageDescription = None
|
testImageDescription = None
|
||||||
testCity = 'London, England'
|
testCity = 'London, England'
|
||||||
|
testInReplyTo = None
|
||||||
|
testInReplyToAtomUri = None
|
||||||
|
testSubject = None
|
||||||
|
testSchedulePost = False
|
||||||
|
testEventDate = None
|
||||||
|
testEventTime = None
|
||||||
|
testLocation = None
|
||||||
|
testIsArticle = False
|
||||||
|
|
||||||
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",
|
||||||
|
@ -2318,7 +2326,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity)
|
testMediaType, testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"Zoiks!!!",
|
"Zoiks!!!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2326,7 +2338,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity)
|
testMediaType, testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
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",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2334,7 +2350,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity)
|
testMediaType, testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"Getting kinda spooky around here",
|
"Getting kinda spooky around here",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2343,7 +2363,10 @@ if args.testdata:
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity,
|
testMediaType, testImageDescription, testCity,
|
||||||
'someone')
|
'someone', testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
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",
|
||||||
|
@ -2352,7 +2375,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
'img/logo.png', 'image/png',
|
'img/logo.png', 'image/png',
|
||||||
'Description of image', testCity)
|
'Description of image', testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
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!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2360,7 +2387,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity)
|
testMediaType, testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"another mystery solved #test",
|
"another mystery solved #test",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2368,7 +2399,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity)
|
testMediaType, testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"let's go bowling",
|
"let's go bowling",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2376,8 +2411,11 @@ if args.testdata:
|
||||||
testC2S,
|
testC2S,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType, testImageDescription, testCity)
|
testMediaType, testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
domainFull = domain + ':' + str(port)
|
domainFull = domain + ':' + str(port)
|
||||||
clearFollows(baseDir, nickname, domain)
|
clearFollows(baseDir, nickname, domain)
|
||||||
followPerson(baseDir, nickname, domain, 'maxboardroom', domainFull,
|
followPerson(baseDir, nickname, domain, 'maxboardroom', domainFull,
|
||||||
|
|
12
posts.py
12
posts.py
|
@ -1426,12 +1426,12 @@ def createPublicPost(baseDir: str,
|
||||||
clientToServer: bool, commentsEnabled: bool,
|
clientToServer: bool, commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, city: str,
|
imageDescription: str, city: str,
|
||||||
inReplyTo: str = None,
|
inReplyTo: str,
|
||||||
inReplyToAtomUri: str = None, subject: str = None,
|
inReplyToAtomUri: str, subject: str,
|
||||||
schedulePost: bool = False,
|
schedulePost: bool,
|
||||||
eventDate: str = None, eventTime: str = None,
|
eventDate: str, eventTime: str,
|
||||||
location: str = None,
|
location: str,
|
||||||
isArticle: bool = False) -> {}:
|
isArticle: bool) -> {}:
|
||||||
"""Public post
|
"""Public post
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
|
117
tests.py
117
tests.py
|
@ -477,6 +477,14 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testMediaType = None
|
testMediaType = None
|
||||||
testImageDescription = None
|
testImageDescription = None
|
||||||
testCity = 'London, England'
|
testCity = 'London, England'
|
||||||
|
testInReplyTo = None
|
||||||
|
testInReplyToAtomUri = None
|
||||||
|
testSubject = None
|
||||||
|
testSchedulePost = False
|
||||||
|
testEventDate = None
|
||||||
|
testEventTime = None
|
||||||
|
testLocation = None
|
||||||
|
testIsArticle = 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",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -485,7 +493,11 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType,
|
testMediaType,
|
||||||
testImageDescription, testCity)
|
testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"Curiouser and curiouser!",
|
"Curiouser and curiouser!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -494,7 +506,11 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType,
|
testMediaType,
|
||||||
testImageDescription, testCity)
|
testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
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",
|
||||||
|
@ -504,7 +520,11 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType,
|
testMediaType,
|
||||||
testImageDescription, testCity)
|
testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
global testServerAliceRunning
|
global testServerAliceRunning
|
||||||
testServerAliceRunning = True
|
testServerAliceRunning = True
|
||||||
maxMentions = 10
|
maxMentions = 10
|
||||||
|
@ -582,6 +602,14 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testImageDescription = None
|
testImageDescription = None
|
||||||
testMediaType = None
|
testMediaType = None
|
||||||
testCity = 'London, England'
|
testCity = 'London, England'
|
||||||
|
testInReplyTo = None
|
||||||
|
testInReplyToAtomUri = None
|
||||||
|
testSubject = None
|
||||||
|
testSchedulePost = False
|
||||||
|
testEventDate = None
|
||||||
|
testEventTime = None
|
||||||
|
testLocation = None
|
||||||
|
testIsArticle = False
|
||||||
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.",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -590,7 +618,11 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType,
|
testMediaType,
|
||||||
testImageDescription, testCity)
|
testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
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",
|
||||||
|
@ -600,7 +632,11 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType,
|
testMediaType,
|
||||||
testImageDescription, testCity)
|
testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
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",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -609,7 +645,11 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testCommentsEnabled,
|
testCommentsEnabled,
|
||||||
testAttachImageFilename,
|
testAttachImageFilename,
|
||||||
testMediaType,
|
testMediaType,
|
||||||
testImageDescription, testCity)
|
testImageDescription, testCity,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
global testServerBobRunning
|
global testServerBobRunning
|
||||||
testServerBobRunning = True
|
testServerBobRunning = True
|
||||||
maxMentions = 10
|
maxMentions = 10
|
||||||
|
@ -1435,10 +1475,28 @@ def _testCreatePerson():
|
||||||
setBio(baseDir, nickname, domain, 'Randomly roaming in your backyard')
|
setBio(baseDir, nickname, domain, 'Randomly roaming in your backyard')
|
||||||
archivePostsForPerson(nickname, domain, baseDir, 'inbox', None, {}, 4)
|
archivePostsForPerson(nickname, domain, baseDir, 'inbox', None, {}, 4)
|
||||||
archivePostsForPerson(nickname, domain, baseDir, 'outbox', None, {}, 4)
|
archivePostsForPerson(nickname, domain, baseDir, 'outbox', None, {}, 4)
|
||||||
|
testInReplyTo = None
|
||||||
|
testInReplyToAtomUri = None
|
||||||
|
testSubject = None
|
||||||
|
testSchedulePost = False
|
||||||
|
testEventDate = None
|
||||||
|
testEventTime = None
|
||||||
|
testLocation = None
|
||||||
|
testIsArticle = False
|
||||||
|
content = "G'day world!"
|
||||||
|
followersOnly = False
|
||||||
|
saveToFile = True
|
||||||
|
commentsEnabled = True
|
||||||
|
attachImageFilename = None
|
||||||
|
mediaType = None
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"G'day world!", False, True, clientToServer,
|
content, followersOnly, saveToFile, clientToServer,
|
||||||
True, None, None, None, None,
|
commentsEnabled, attachImageFilename, mediaType,
|
||||||
'Not suitable for Vogons', 'London, England')
|
'Not suitable for Vogons', 'London, England',
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
|
|
||||||
os.chdir(currDir)
|
os.chdir(currDir)
|
||||||
shutil.rmtree(baseDir)
|
shutil.rmtree(baseDir)
|
||||||
|
@ -2821,12 +2879,23 @@ def _testReplyToPublicPost() -> None:
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = 'Some description'
|
imageDescription = 'Some description'
|
||||||
city = 'London, England'
|
city = 'London, England'
|
||||||
|
testInReplyToAtomUri = None
|
||||||
|
testSubject = None
|
||||||
|
testSchedulePost = False
|
||||||
|
testEventDate = None
|
||||||
|
testEventTime = None
|
||||||
|
testLocation = None
|
||||||
|
testIsArticle = False
|
||||||
reply = \
|
reply = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
content, followersOnly, saveToFile,
|
content, followersOnly, saveToFile,
|
||||||
clientToServer, commentsEnabled,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, city, postId)
|
imageDescription, city, postId,
|
||||||
|
testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
# print(str(reply))
|
# print(str(reply))
|
||||||
assert reply['object']['content'] == \
|
assert reply['object']['content'] == \
|
||||||
'<p><span class=\"h-card\">' + \
|
'<p><span class=\"h-card\">' + \
|
||||||
|
@ -3384,16 +3453,30 @@ def _testLinksWithinPost() -> None:
|
||||||
saveToFile = False
|
saveToFile = False
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
commentsEnabled = True
|
commentsEnabled = True
|
||||||
|
attachImageFilename = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = None
|
imageDescription = None
|
||||||
city = 'London, England'
|
city = 'London, England'
|
||||||
|
testInReplyTo = None
|
||||||
|
testInReplyToAtomUri = None
|
||||||
|
testSubject = None
|
||||||
|
testSchedulePost = False
|
||||||
|
testEventDate = None
|
||||||
|
testEventTime = None
|
||||||
|
testLocation = None
|
||||||
|
testIsArticle = False
|
||||||
|
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
content, followersOnly, saveToFile,
|
content, followersOnly, saveToFile,
|
||||||
clientToServer, commentsEnabled,
|
clientToServer, commentsEnabled,
|
||||||
mediaType, imageDescription, city,
|
attachImageFilename, mediaType,
|
||||||
False, None)
|
imageDescription, city,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
|
|
||||||
assert postJsonObject['object']['content'] == \
|
assert postJsonObject['object']['content'] == \
|
||||||
'<p>This is a test post with links.<br><br>' + \
|
'<p>This is a test post with links.<br><br>' + \
|
||||||
'<a href="ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/" ' + \
|
'<a href="ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/" ' + \
|
||||||
|
@ -3419,8 +3502,14 @@ def _testLinksWithinPost() -> None:
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
content,
|
content,
|
||||||
False, False, False, True,
|
False, False,
|
||||||
None, None, False, None)
|
False, True,
|
||||||
|
None, None,
|
||||||
|
False, None,
|
||||||
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
|
testSubject, testSchedulePost,
|
||||||
|
testEventDate, testEventTime, testLocation,
|
||||||
|
testIsArticle)
|
||||||
assert postJsonObject['object']['content'] == content
|
assert postJsonObject['object']['content'] == content
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue