forked from indymedia/epicyon
				
			Test for actor parsing
							parent
							
								
									58f78f1751
								
							
						
					
					
						commit
						0bfb3b578e
					
				|  | @ -62,14 +62,14 @@ The following are considered antifeatures of other social network systems, since | |||
| On Arch/Parabola: | ||||
| 
 | ||||
| ``` bash | ||||
| sudo pacman -S tor python-pip python-pysocks python-pycryptodome python-beautifulsoup4 imagemagick python-pillow python-numpy | ||||
| sudo pacman -S tor python-pip python-pysocks python-pycryptodome python-beautifulsoup4 imagemagick python-pillow python-numpy python-dateutil | ||||
| sudo pip install commentjson | ||||
| ``` | ||||
| 
 | ||||
| Or on Debian: | ||||
| 
 | ||||
| ``` bash | ||||
| sudo apt-get -y install tor python3-pip python3-socks imagemagick python3-numpy python3-setuptools python3-crypto python3-pil.imagetk | ||||
| sudo apt-get -y install tor python3-pip python3-socks imagemagick python3-numpy python3-setuptools python3-crypto python3-dateutil python3-pil.imagetk | ||||
| sudo pip3 install commentjson beautifulsoup4 pycryptodome | ||||
| ``` | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										25
									
								
								tests.py
								
								
								
								
							
							
						
						
									
										25
									
								
								tests.py
								
								
								
								
							|  | @ -38,6 +38,8 @@ from follow import clearFollowers | |||
| from follow import sendFollowRequestViaServer | ||||
| from follow import sendUnfollowRequestViaServer | ||||
| from utils import followPerson | ||||
| from utils import getNicknameFromActor | ||||
| from utils import getDomainFromActor | ||||
| from follow import followerOfPerson | ||||
| from follow import unfollowPerson | ||||
| from follow import unfollowerOfPerson | ||||
|  | @ -1340,8 +1342,31 @@ def testClientToServer(): | |||
|     #shutil.rmtree(aliceDir) | ||||
|     #shutil.rmtree(bobDir) | ||||
| 
 | ||||
| def testActorParsing(): | ||||
|     print('testActorParsing') | ||||
|     actor='https://mydomain:72/users/mynick' | ||||
|     domain,port=getDomainFromActor(actor) | ||||
|     assert domain=='mydomain' | ||||
|     assert port==72 | ||||
|     nickname=getNicknameFromActor(actor) | ||||
|     assert nickname=='mynick' | ||||
| 
 | ||||
|     actor='https://randomain/users/rando' | ||||
|     domain,port=getDomainFromActor(actor) | ||||
|     assert domain=='randomain' | ||||
|     nickname=getNicknameFromActor(actor) | ||||
|     assert nickname=='rando' | ||||
| 
 | ||||
|     actor='https://otherdomain:49/@othernick' | ||||
|     domain,port=getDomainFromActor(actor) | ||||
|     assert domain=='otherdomain' | ||||
|     assert port==49 | ||||
|     nickname=getNicknameFromActor(actor) | ||||
|     assert nickname=='othernick' | ||||
| 
 | ||||
| def runAllTests(): | ||||
|     print('Running tests...') | ||||
|     testActorParsing() | ||||
|     testHttpsig() | ||||
|     testCache() | ||||
|     testThreads() | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue