Add checks for followers and following

master
Bob Mottram 2019-07-06 18:15:03 +01:00
parent 3a6fe719a9
commit 755d28f3e1
2 changed files with 11 additions and 6 deletions

View File

@ -292,8 +292,8 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
print('DEBUG: followed account not found - '+ \ print('DEBUG: followed account not found - '+ \
baseDir+'/accounts/'+handleToFollow) baseDir+'/accounts/'+handleToFollow)
return False return False
if not followerOfPerson(baseDir,nickname,domain, \ if not followerOfPerson(baseDir,nicknameToFollow,domainToFollow, \
nicknameToFollow,domainToFollow,federationList): nickname,domain,federationList):
if debug: if debug:
print('DEBUG: '+nickname+'@'+domain+ \ print('DEBUG: '+nickname+'@'+domain+ \
' is already a follower of '+ \ ' is already a follower of '+ \

View File

@ -310,8 +310,10 @@ def testFollowBetweenServers():
aliceCachedWebfingers,alicePersonCache,True) aliceCachedWebfingers,alicePersonCache,True)
print('sendResult: '+str(sendResult)) print('sendResult: '+str(sendResult))
time.sleep(10) for t in range(10):
if os.path.isfile(bobDir+'/accounts/bob@'+bobDomain+'/followers.txt'):
break
time.sleep(1)
# stop the servers # stop the servers
thrAlice.kill() thrAlice.kill()
@ -322,8 +324,11 @@ def testFollowBetweenServers():
thrBob.join() thrBob.join()
assert thrBob.isAlive()==False assert thrBob.isAlive()==False
assert 'alice@'+aliceDomain in open(bobDir+'/accounts/bob@'+bobDomain+'/followers.txt').read()
assert 'bob@'+bobDomain in open(aliceDir+'/accounts/alice@'+aliceDomain+'/following.txt').read()
os.chdir(baseDir) os.chdir(baseDir)
#shutil.rmtree(baseDir+'/.tests') shutil.rmtree(baseDir+'/.tests')
def testFollowersOfPerson(): def testFollowersOfPerson():
print('testFollowersOfPerson') print('testFollowersOfPerson')