forked from indymedia/epicyon
Test person creation
parent
8c590d7402
commit
435f16e9df
|
@ -92,7 +92,7 @@ personCache={}
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
|
|
||||||
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(baseDir,nickname,domain,port,https,True)
|
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(baseDir,nickname,domain,port,https,True)
|
||||||
#deleteAllPosts(nickname,domain)
|
#deleteAllPosts(baseDir,nickname,domain)
|
||||||
setPreferredNickname(baseDir,nickname,domain,'badger')
|
setPreferredNickname(baseDir,nickname,domain,'badger')
|
||||||
setBio(baseDir,nickname,domain,'Some personal info')
|
setBio(baseDir,nickname,domain,'Some personal info')
|
||||||
#createPublicPost(baseDir,nickname, domain, port,https, "G'day world!", False, True, None, None, 'Not suitable for Vogons')
|
#createPublicPost(baseDir,nickname, domain, port,https, "G'day world!", False, True, None, None, 'Not suitable for Vogons')
|
||||||
|
|
2
posts.py
2
posts.py
|
@ -223,7 +223,7 @@ def createOutboxArchive(nickname: str,domain: str,baseDir: str) -> str:
|
||||||
os.mkdir(outboxArchiveDir)
|
os.mkdir(outboxArchiveDir)
|
||||||
return outboxArchiveDir
|
return outboxArchiveDir
|
||||||
|
|
||||||
def deleteAllPosts(nickname: str, domain: str,baseDir: str) -> None:
|
def deleteAllPosts(baseDir: str,nickname: str, domain: str) -> None:
|
||||||
"""Deletes all posts for a person
|
"""Deletes all posts for a person
|
||||||
"""
|
"""
|
||||||
outboxDir = createOutboxDir(nickname,domain,baseDir)
|
outboxDir = createOutboxDir(nickname,domain,baseDir)
|
||||||
|
|
31
tests.py
31
tests.py
|
@ -19,7 +19,6 @@ from cache import getPersonFromCache
|
||||||
from threads import threadWithTrace
|
from threads import threadWithTrace
|
||||||
from daemon import runDaemon
|
from daemon import runDaemon
|
||||||
from session import createSession
|
from session import createSession
|
||||||
from person import createPerson
|
|
||||||
from posts import deleteAllPosts
|
from posts import deleteAllPosts
|
||||||
from posts import createPublicPost
|
from posts import createPublicPost
|
||||||
from posts import sendPost
|
from posts import sendPost
|
||||||
|
@ -29,6 +28,9 @@ from follow import followPerson
|
||||||
from follow import followerOfPerson
|
from follow import followerOfPerson
|
||||||
from follow import unfollowPerson
|
from follow import unfollowPerson
|
||||||
from follow import unfollowerOfPerson
|
from follow import unfollowerOfPerson
|
||||||
|
from person import createPerson
|
||||||
|
from person import setPreferredNickname
|
||||||
|
from person import setBio
|
||||||
|
|
||||||
testServerAliceRunning = False
|
testServerAliceRunning = False
|
||||||
testServerBobRunning = False
|
testServerBobRunning = False
|
||||||
|
@ -108,7 +110,7 @@ def createServerAlice(path: str,domain: str,port: int,federationList: []):
|
||||||
https=False
|
https=False
|
||||||
useTor=False
|
useTor=False
|
||||||
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(path,nickname,domain,port,https,True)
|
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(path,nickname,domain,port,https,True)
|
||||||
deleteAllPosts(nickname,domain,path)
|
deleteAllPosts(path,nickname,domain)
|
||||||
followPerson(path,nickname,domain,'bob','127.0.0.100:61936',federationList)
|
followPerson(path,nickname,domain,'bob','127.0.0.100:61936',federationList)
|
||||||
followerOfPerson(path,nickname,domain,'bob','127.0.0.100:61936',federationList)
|
followerOfPerson(path,nickname,domain,'bob','127.0.0.100:61936',federationList)
|
||||||
createPublicPost(path,nickname, domain, port,https, "No wise fish would go anywhere without a porpoise", False, True)
|
createPublicPost(path,nickname, domain, port,https, "No wise fish would go anywhere without a porpoise", False, True)
|
||||||
|
@ -129,7 +131,7 @@ def createServerBob(path: str,domain: str,port: int,federationList: []):
|
||||||
https=False
|
https=False
|
||||||
useTor=False
|
useTor=False
|
||||||
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(path,nickname,domain,port,https,True)
|
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(path,nickname,domain,port,https,True)
|
||||||
deleteAllPosts(nickname,domain,path)
|
deleteAllPosts(path,nickname,domain)
|
||||||
followPerson(path,nickname,domain,'alice','127.0.0.50:61935',federationList)
|
followPerson(path,nickname,domain,'alice','127.0.0.50:61935',federationList)
|
||||||
followerOfPerson(path,nickname,domain,'alice','127.0.0.50:61935',federationList)
|
followerOfPerson(path,nickname,domain,'alice','127.0.0.50:61935',federationList)
|
||||||
createPublicPost(path,nickname, domain, port,https, "It's your life, live it your way.", False, True)
|
createPublicPost(path,nickname, domain, port,https, "It's your life, live it your way.", False, True)
|
||||||
|
@ -207,6 +209,7 @@ def testPostMessageBetweenServers():
|
||||||
assert thrBob.isAlive()==False
|
assert thrBob.isAlive()==False
|
||||||
|
|
||||||
def testFollows():
|
def testFollows():
|
||||||
|
print('testFollows')
|
||||||
currDir=os.getcwd()
|
currDir=os.getcwd()
|
||||||
nickname='test529'
|
nickname='test529'
|
||||||
domain='testdomain.com'
|
domain='testdomain.com'
|
||||||
|
@ -264,11 +267,33 @@ def testFollows():
|
||||||
os.chdir(currDir)
|
os.chdir(currDir)
|
||||||
shutil.rmtree(baseDir)
|
shutil.rmtree(baseDir)
|
||||||
|
|
||||||
|
def testCreatePerson():
|
||||||
|
print('testCreatePerson')
|
||||||
|
currDir=os.getcwd()
|
||||||
|
nickname='test382'
|
||||||
|
domain='badgerdomain.com'
|
||||||
|
port=80
|
||||||
|
https=True
|
||||||
|
baseDir=currDir+'/.tests_createperson'
|
||||||
|
if os.path.isdir(baseDir):
|
||||||
|
shutil.rmtree(baseDir)
|
||||||
|
os.mkdir(baseDir)
|
||||||
|
os.chdir(baseDir)
|
||||||
|
|
||||||
|
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(baseDir,nickname,domain,port,https,True)
|
||||||
|
deleteAllPosts(baseDir,nickname,domain)
|
||||||
|
setPreferredNickname(baseDir,nickname,domain,'badger')
|
||||||
|
setBio(baseDir,nickname,domain,'Randomly roaming in your backyard')
|
||||||
|
|
||||||
|
os.chdir(currDir)
|
||||||
|
shutil.rmtree(baseDir)
|
||||||
|
|
||||||
def runAllTests():
|
def runAllTests():
|
||||||
print('Running tests...')
|
print('Running tests...')
|
||||||
testHttpsig()
|
testHttpsig()
|
||||||
testCache()
|
testCache()
|
||||||
testThreads()
|
testThreads()
|
||||||
|
testCreatePerson()
|
||||||
testFollows()
|
testFollows()
|
||||||
print('Tests succeeded\n')
|
print('Tests succeeded\n')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue