Fix unit test for like

main2
Bob Mottram 2019-10-19 19:08:47 +01:00
parent 255a32c0dc
commit 236aef17ba
3 changed files with 19 additions and 24 deletions

View File

@ -4826,7 +4826,7 @@ def runDaemon(projectVersion, \
httpd.ocapAlways,maxReplies, \
domainMaxPostsPerDay,accountMaxPostsPerDay, \
allowDeletion,debug,maxMentions,httpd.translate, \
httpd.acceptedCaps),daemon=True)
unitTest,httpd.acceptedCaps),daemon=True)
if not unitTest:
httpd.thrWatchdog= \
threadWithTrace(target=runInboxQueueWatchdog, \

View File

@ -1513,7 +1513,8 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
acceptedCaps: [], \
queueFilename :str,destinationFilename :str, \
maxReplies: int,allowDeletion: bool, \
maxMentions: int,translate: {}) -> bool:
maxMentions: int,translate: {}, \
unitTest: bool) -> bool:
""" Anything which needs to be done after capabilities checks have passed
"""
actor=keyId
@ -1640,14 +1641,16 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
if postSavedToFile:
inboxUpdateCalendar(baseDir,handle,postJsonObject)
if debug:
print('DEBUG: saving inbox post as html to cache')
inboxStorePostToHtmlCache(translate,baseDir,httpPrefix, \
session,cachedWebfingers,personCache, \
handle.split('@')[0],domain,port, \
postJsonObject,allowDeletion)
if debug:
print('DEBUG: saved inbox post as html to cache')
if not unitTest:
if debug:
print('DEBUG: saving inbox post as html to cache')
inboxStorePostToHtmlCache(translate,baseDir,httpPrefix, \
session,cachedWebfingers,personCache, \
handle.split('@')[0],domain,port, \
postJsonObject,allowDeletion)
if debug:
print('DEBUG: saved inbox post as html to cache')
# send the post out to group members
if isGroup:
@ -1697,7 +1700,7 @@ def runInboxQueue(projectVersion: str, \
ocapAlways: bool,maxReplies: int, \
domainMaxPostsPerDay: int,accountMaxPostsPerDay: int, \
allowDeletion: bool,debug: bool,maxMentions: int, \
translate: {}, \
translate: {},unitTest: bool, \
acceptedCaps=["inbox:write","objects:read"]) -> None:
"""Processes received items and moves them to
the appropriate directories
@ -2057,7 +2060,7 @@ def runInboxQueue(projectVersion: str, \
debug,acceptedCaps, \
queueFilename,destination, \
maxReplies,allowDeletion, \
maxMentions,translate)
maxMentions,translate,unitTest)
else:
if debug:
print('DEBUG: object capabilities check has failed')
@ -2075,7 +2078,7 @@ def runInboxQueue(projectVersion: str, \
debug,acceptedCaps, \
queueFilename,destination, \
maxReplies,allowDeletion, \
maxMentions,translate)
maxMentions,translate,unitTest)
if debug:
pprint(queueJson['post'])
print('No capability list within post')

View File

@ -44,17 +44,9 @@ class threadWithTrace(threading.Thread):
self.isStarted=True
def __run(self):
tries=0
while tries<3:
try:
sys.settrace(self.globaltrace)
self.__run_backup()
self.run = self.__run_backup
break
except Exception as e:
print('ERROR: threads.py/__run failed - '+str(e))
time.sleep(1)
tries+=1
sys.settrace(self.globaltrace)
self.__run_backup()
self.run = self.__run_backup
def globaltrace(self, frame, event, arg):
if event == 'call':