mirror of https://gitlab.com/bashrc2/epicyon
Receiving likes
parent
c301f45b33
commit
f301139626
|
@ -388,7 +388,6 @@ if args.changepassword:
|
|||
if not args.domain and not domain:
|
||||
print('Specify a domain with --domain [name]')
|
||||
sys.exit()
|
||||
|
||||
|
||||
if federationList:
|
||||
print('Federating with: '+str(federationList))
|
||||
|
@ -400,10 +399,6 @@ if not os.path.isdir(baseDir+'/accounts/'+nickname+'@'+domain):
|
|||
setConfigParam(baseDir,'adminPassword',adminPassword)
|
||||
createPerson(baseDir,nickname,domain,port,httpPrefix,True,adminPassword)
|
||||
|
||||
#if not os.path.isdir(baseDir+'/accounts/capabilities@'+domain):
|
||||
# print('Creating capabilities account which can sign requests')
|
||||
# createCapabilitiesInbox(baseDir,'capabilities',domain,port,httpPrefix)
|
||||
|
||||
if args.testdata:
|
||||
nickname='testuser567'
|
||||
print('Generating some test data for user: '+nickname)
|
||||
|
|
4
inbox.py
4
inbox.py
|
@ -432,8 +432,8 @@ def receiveLike(session,handle: str,baseDir: str, \
|
|||
print(messageJson['object'])
|
||||
return True
|
||||
if debug:
|
||||
print('DEBUG: liked post found in '+boxName)
|
||||
updateLikesCollection(postFilename,messageJson['object'],messageJson['actor'])
|
||||
print('DEBUG: liked post found in inbox')
|
||||
updateLikesCollection(postFilename,messageJson['object'],messageJson['actor'],debug)
|
||||
return True
|
||||
|
||||
def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
|
||||
|
|
64
tests.py
64
tests.py
|
@ -278,43 +278,41 @@ def testPostMessageBetweenServers():
|
|||
# queue item removed
|
||||
assert len([name for name in os.listdir(queuePath) if os.path.isfile(os.path.join(queuePath, name))])==0
|
||||
|
||||
#print('\n\n*******************************************************')
|
||||
#print("Bob likes Alice's post")
|
||||
print('\n\n*******************************************************')
|
||||
print("Bob likes Alice's post")
|
||||
|
||||
#followerOfPerson(bobDir,'bob',bobDomain,'alice',aliceDomain+':'+str(alicePort),federationList,True)
|
||||
#followPerson(aliceDir,'alice',aliceDomain,'bob',bobDomain+':'+str(bobPort),federationList,True)
|
||||
#followList=getFollowersOfPerson(bobDir,'bob',bobDomain,'followers.txt')
|
||||
#assert len(followList)==1
|
||||
followerOfPerson(bobDir,'bob',bobDomain,'alice',aliceDomain+':'+str(alicePort),federationList,True)
|
||||
followPerson(aliceDir,'alice',aliceDomain,'bob',bobDomain+':'+str(bobPort),federationList,True)
|
||||
|
||||
#sessionBob = createSession(bobDomain,bobPort,useTor)
|
||||
#bobSendThreads = []
|
||||
#bobPostLog = []
|
||||
#bobPersonCache={}
|
||||
#bobCachedWebfingers={}
|
||||
#statusNumber=None
|
||||
#outboxPostFilename=None
|
||||
#outboxPath=aliceDir+'/accounts/alice@'+aliceDomain+'/outbox'
|
||||
#for name in os.listdir(outboxPath):
|
||||
# if '#statuses#' in name:
|
||||
# statusNumber=int(name.split('#statuses#')[1].replace('.json',''))
|
||||
# outboxPostFilename=outboxPath+'/'+name
|
||||
#assert statusNumber
|
||||
#assert outboxPostFilename
|
||||
#assert likePost(sessionBob,bobDir,federationList, \
|
||||
# 'bob',bobDomain,bobPort,httpPrefix, \
|
||||
# 'alice',aliceDomain,alicePort,[], \
|
||||
# statusNumber,False,bobSendThreads,bobPostLog, \
|
||||
# bobPersonCache,bobCachedWebfingers,True)
|
||||
sessionBob = createSession(bobDomain,bobPort,useTor)
|
||||
bobSendThreads = []
|
||||
bobPostLog = []
|
||||
bobPersonCache={}
|
||||
bobCachedWebfingers={}
|
||||
statusNumber=None
|
||||
outboxPostFilename=None
|
||||
outboxPath=aliceDir+'/accounts/alice@'+aliceDomain+'/outbox'
|
||||
for name in os.listdir(outboxPath):
|
||||
if '#statuses#' in name:
|
||||
statusNumber=int(name.split('#statuses#')[1].replace('.json',''))
|
||||
outboxPostFilename=outboxPath+'/'+name
|
||||
assert statusNumber
|
||||
assert outboxPostFilename
|
||||
assert likePost(sessionBob,bobDir,federationList, \
|
||||
'bob',bobDomain,bobPort,httpPrefix, \
|
||||
'alice',aliceDomain,alicePort,[], \
|
||||
statusNumber,False,bobSendThreads,bobPostLog, \
|
||||
bobPersonCache,bobCachedWebfingers,True)
|
||||
|
||||
#for i in range(20):
|
||||
# if 'likes' in open(outboxPostFilename).read():
|
||||
# break
|
||||
# time.sleep(1)
|
||||
for i in range(20):
|
||||
if 'likes' in open(outboxPostFilename).read():
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
#with open(outboxPostFilename, 'r') as fp:
|
||||
# alicePostJson=commentjson.load(fp)
|
||||
# pprint(alicePostJson)
|
||||
#assert 'likes' in open(outboxPostFilename).read()
|
||||
with open(outboxPostFilename, 'r') as fp:
|
||||
alicePostJson=commentjson.load(fp)
|
||||
pprint(alicePostJson)
|
||||
assert 'likes' in open(outboxPostFilename).read()
|
||||
|
||||
# stop the servers
|
||||
thrAlice.kill()
|
||||
|
|
Loading…
Reference in New Issue