diff --git a/epicyon.py b/epicyon.py index 987ef53b0..fb3b9f83b 100644 --- a/epicyon.py +++ b/epicyon.py @@ -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) diff --git a/inbox.py b/inbox.py index d1cb8a968..0c55791db 100644 --- a/inbox.py +++ b/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: {}, \ diff --git a/tests.py b/tests.py index cad06654b..87abce406 100644 --- a/tests.py +++ b/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()