From 0e5e60d6543e0c9c18071a9d8f8837e0e2a66a3e Mon Sep 17 00:00:00 2001
From: Bob Mottram Text without formatting Text with formatting This is a valid message This content has no quote.
This is a test' + \
@@ -2704,7 +2704,7 @@ def testFirstParagraphFromString():
assert resultStr == testStr
-def testParseFeedDate():
+def _testParseFeedDate():
print('testParseFeedDate')
pubDate = "2020-12-14T00:08:06+00:00"
@@ -2724,7 +2724,7 @@ def testParseFeedDate():
assert publishedDate == "2020-11-22 18:51:33+00:00"
-def testValidNickname():
+def _testValidNickname():
print('testValidNickname')
domain = 'somedomain.net'
@@ -2741,7 +2741,7 @@ def testValidNickname():
assert not validNickname(domain, nickname)
-def testGuessHashtagCategory() -> None:
+def _testGuessHashtagCategory() -> None:
print('testGuessHashtagCategory')
hashtagCategories = {
"foo": ["swan", "goose"],
@@ -2754,7 +2754,7 @@ def testGuessHashtagCategory() -> None:
assert guess == "bar"
-def testGetMentionedPeople() -> None:
+def _testGetMentionedPeople() -> None:
print('testGetMentionedPeople')
baseDir = os.getcwd()
@@ -2768,7 +2768,7 @@ def testGetMentionedPeople() -> None:
assert actors[1] == "https://cave.site/users/bat"
-def testReplyToPublicPost() -> None:
+def _testReplyToPublicPost() -> None:
baseDir = os.getcwd()
nickname = 'test7492362'
domain = 'other.site'
@@ -2810,7 +2810,7 @@ def testReplyToPublicPost() -> None:
httpPrefix + '://rat.site/users/ninjarodent'
-def getFunctionCallArgs(name: str, lines: [], startLineCtr: int) -> []:
+def _getFunctionCallArgs(name: str, lines: [], startLineCtr: int) -> []:
"""Returns the arguments of a function call given lines
of source code and a starting line number
"""
@@ -2848,7 +2848,7 @@ def getFunctionCalls(name: str, lines: [], startLineCtr: int,
return callsFunctions
-def functionArgsMatch(callArgs: [], funcArgs: []):
+def _functionArgsMatch(callArgs: [], funcArgs: []):
"""Do the function artuments match the function call arguments
"""
if len(callArgs) == len(funcArgs):
@@ -2872,7 +2872,7 @@ def functionArgsMatch(callArgs: [], funcArgs: []):
return callArgsCtr >= funcArgsCtr
-def testFunctions():
+def _testFunctions():
print('testFunctions')
function = {}
functionProperties = {}
@@ -2959,11 +2959,11 @@ def testFunctions():
lineCtr += 1
continue
callArgs = \
- getFunctionCallArgs(name,
- modules[modName]['lines'],
- lineCtr)
- if not functionArgsMatch(callArgs,
- functionProperties[name]['args']):
+ _getFunctionCallArgs(name,
+ modules[modName]['lines'],
+ lineCtr)
+ funcArgs = functionProperties[name]['args']
+ if not _functionArgsMatch(callArgs, funcArgs):
print('Call to function ' + name +
' does not match its arguments')
print('def args: ' +
@@ -3012,7 +3012,7 @@ def testFunctions():
'runSharesExpireWatchdog',
'getThisWeeksEvents',
'getAvailability',
- 'testThreadsFunction',
+ '_testThreadsFunction',
'createServerAlice',
'createServerBob',
'createServerEve',
@@ -3224,7 +3224,7 @@ def testFunctions():
'-Gsep=+120 -Tx11 epicyon.dot')
-def testLinksWithinPost() -> None:
+def _testLinksWithinPost() -> None:
baseDir = os.getcwd()
nickname = 'test27636'
domain = 'rando.site'
@@ -3276,7 +3276,7 @@ def testLinksWithinPost() -> None:
assert postJsonObject['object']['content'] == content
-def testMastoApi():
+def _testMastoApi():
print('testMastoApi')
nickname = 'ThisIsATestNickname'
mastoId = getMastoApiV1IdFromNickname(nickname)
@@ -3287,7 +3287,7 @@ def testMastoApi():
assert nickname2 == nickname
-def testDomainHandling():
+def _testDomainHandling():
print('testDomainHandling')
testDomain = 'localhost'
assert decodedHost(testDomain) == testDomain
@@ -3299,7 +3299,7 @@ def testDomainHandling():
assert decodedHost(testDomain) == "españa.icom.museum"
-def testPrepareHtmlPostNickname():
+def _testPrepareHtmlPostNickname():
print('testPrepareHtmlPostNickname')
postHtml = '.'
-def testExtractTextFieldsInPOST():
+def _testExtractTextFieldsInPOST():
print('testExtractTextFieldsInPOST')
boundary = '-----------------------------116202748023898664511855843036'
formData = '-----------------------------116202748023898664511855' + \
@@ -3413,7 +3413,7 @@ def testExtractTextFieldsInPOST():
assert fields['message'] == 'This is a ; test'
-def testSpeakerReplaceLinks():
+def _testSpeakerReplaceLinks():
print('testSpeakerReplaceLinks')
text = 'The Tor Project: For Snowflake volunteers: If you use ' + \
'Firefox, Brave, or Chrome, our Snowflake extension turns ' + \
@@ -3431,7 +3431,7 @@ def testSpeakerReplaceLinks():
assert 'Web link support.torproject.org' in result
-def testCamelCaseSplit():
+def _testCamelCaseSplit():
print('testCamelCaseSplit')
testStr = 'ThisIsCamelCase'
assert camelCaseSplit(testStr) == 'This Is Camel Case'
@@ -3440,7 +3440,7 @@ def testCamelCaseSplit():
assert camelCaseSplit(testStr) == 'Notcamelcase test'
-def testEmojiImages():
+def _testEmojiImages():
print('testEmojiImages')
emojiFilename = 'emoji/default_emoji.json'
assert os.path.isfile(emojiFilename)
@@ -3454,7 +3454,7 @@ def testEmojiImages():
assert os.path.isfile(emojiImageFilename)
-def testExtractPGPPublicKey():
+def _testExtractPGPPublicKey():
print('testExtractPGPPublicKey')
pubKey = \
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n' + \
@@ -3601,7 +3601,7 @@ def testUpdateActor():
shutil.rmtree(baseDir + '/.tests')
-def testRemovePostInteractions() -> None:
+def _testRemovePostInteractions() -> None:
print('testRemovePostInteractions')
postJsonObject = {
"type": "Create",
@@ -3633,7 +3633,7 @@ def testRemovePostInteractions() -> None:
assert not removePostInteractions(postJsonObject, False)
-def testSpoofGeolocation() -> None:
+def _testSpoofGeolocation() -> None:
print('testSpoofGeolocation')
nogoLine = \
'NEW YORK, USA: 73.951W,40.879, 73.974W,40.83, ' + \
@@ -3882,7 +3882,7 @@ def testSpoofGeolocation() -> None:
kmlFile.close()
-def testSkills() -> None:
+def _testSkills() -> None:
print('testSkills')
actorJson = {
'hasOccupation': [
@@ -3908,7 +3908,7 @@ def testSkills() -> None:
assert actorSkillValue(actorJson, 'gardening') == 70
-def testRoles() -> None:
+def _testRoles() -> None:
print('testRoles')
actorJson = {
'hasOccupation': [
@@ -3935,60 +3935,60 @@ def testRoles() -> None:
def runAllTests():
print('Running tests...')
updateDefaultThemesList(os.getcwd())
- testFunctions()
- testRoles()
- testSkills()
- testSpoofGeolocation()
- testRemovePostInteractions()
- testExtractPGPPublicKey()
- testEmojiImages()
- testCamelCaseSplit()
- testSpeakerReplaceLinks()
- testExtractTextFieldsInPOST()
- testMarkdownToHtml()
- testValidHashTag()
- testPrepareHtmlPostNickname()
- testDomainHandling()
- testMastoApi()
- testLinksWithinPost()
- testReplyToPublicPost()
- testGetMentionedPeople()
- testGuessHashtagCategory()
- testValidNickname()
- testParseFeedDate()
- testFirstParagraphFromString()
- testGetNewswireTags()
- testHashtagRuleTree()
- testRemoveHtmlTag()
- testReplaceEmailQuote()
- testConstantTimeStringCheck()
- testTranslations()
- testValidContentWarning()
- testRemoveIdEnding()
- testJsonPostAllowsComments()
- runHtmlReplaceQuoteMarks()
- testDangerousCSS()
- testDangerousMarkup()
- testRemoveHtml()
- testSiteIsActive()
- testJsonld()
- testRemoveTextFormatting()
- testWebLinks()
- testRecentPostsCache()
- testTheme()
- testSaveLoadJson()
- testJsonString()
- testGetStatusNumber()
- testAddEmoji()
- testActorParsing()
- testHttpsig()
- testHttpSigNew()
- testCache()
- testThreads()
- testCreatePerson()
- testAuthentication()
- testFollowersOfPerson()
- testNoOfFollowersOnDomain()
- testFollows()
- testGroupFollowers()
+ _testFunctions()
+ _testRoles()
+ _testSkills()
+ _testSpoofGeolocation()
+ _testRemovePostInteractions()
+ _testExtractPGPPublicKey()
+ _testEmojiImages()
+ _testCamelCaseSplit()
+ _testSpeakerReplaceLinks()
+ _testExtractTextFieldsInPOST()
+ _testMarkdownToHtml()
+ _testValidHashTag()
+ _testPrepareHtmlPostNickname()
+ _testDomainHandling()
+ _testMastoApi()
+ _testLinksWithinPost()
+ _testReplyToPublicPost()
+ _testGetMentionedPeople()
+ _testGuessHashtagCategory()
+ _testValidNickname()
+ _testParseFeedDate()
+ _testFirstParagraphFromString()
+ _testGetNewswireTags()
+ _testHashtagRuleTree()
+ _testRemoveHtmlTag()
+ _testReplaceEmailQuote()
+ _testConstantTimeStringCheck()
+ _testTranslations()
+ _testValidContentWarning()
+ _testRemoveIdEnding()
+ _testJsonPostAllowsComments()
+ _runHtmlReplaceQuoteMarks()
+ _testDangerousCSS()
+ _testDangerousMarkup()
+ _testRemoveHtml()
+ _testSiteIsActive()
+ _testJsonld()
+ _testRemoveTextFormatting()
+ _testWebLinks()
+ _testRecentPostsCache()
+ _testTheme()
+ _testSaveLoadJson()
+ _testJsonString()
+ _testGetStatusNumber()
+ _testAddEmoji()
+ _testActorParsing()
+ _testHttpsig()
+ _testHttpSigNew()
+ _testCache()
+ _testThreads()
+ _testCreatePerson()
+ _testAuthentication()
+ _testFollowersOfPerson()
+ _testNoOfFollowersOnDomain()
+ _testFollows()
+ _testGroupFollowers()
print('Tests succeeded\n')