fix test_server and reorganize requirements files

This commit is contained in:
Cléber Zavadniak 2018-04-19 23:00:22 -03:00 committed by Pedro Ferreira
parent dc1389d634
commit aab2ac18b3
7 changed files with 23 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.cache .cache
.coverage .coverage
.pytest_cache/
__pycache__ __pycache__
*.pyc *.pyc
node_modules node_modules

View File

@ -47,10 +47,13 @@ async def test_client():
handler.send(True, end=True) handler.send(True, end=True)
break break
"""
# TODO: save this blob, first.
async for data in api.call('blobs.get', ['&/6q7JOKythgnnzoBI5xxvotCr5HeFkAIZSAuqHiZfLw=.sha256'], 'source'): async for data in api.call('blobs.get', ['&/6q7JOKythgnnzoBI5xxvotCr5HeFkAIZSAuqHiZfLw=.sha256'], 'source'):
if data.type.name == 'BUFFER': if data.type.name == 'BUFFER':
with open('./funny_img.png', 'wb') as f: with open('./funny_img.png', 'wb') as f:
f.write(data.data) f.write(data.data)
"""
async def main(): async def main():

View File

@ -5,13 +5,15 @@ from colorlog import ColoredFormatter
from secret_handshake import SHSServer from secret_handshake import SHSServer
from ssb.packet_stream import PacketStream from ssb.packet_stream import PacketStream
from ssb.protocol.streams import stream_api from ssb.muxrpc import MuxRPCAPI
from ssb.util import load_ssb_secret from ssb.util import load_ssb_secret
api = MuxRPCAPI()
async def on_connect(conn): async def on_connect(conn):
packet_stream = PacketStream(conn) packet_stream = PacketStream(conn)
stream_api.add_connection(packet_stream) api.add_connection(packet_stream)
print('connect', conn) print('connect', conn)
async for msg in packet_stream: async for msg in packet_stream:

View File

@ -1,4 +1 @@
pynacl -r requirements/production.txt
simplejson
pytest
secret-handshake

2
requirements/dev.txt Normal file
View File

@ -0,0 +1,2 @@
-r tests.txt
flake8

View File

@ -0,0 +1,5 @@
colorlog
pynacl
pyyaml
secret-handshake
simplejson

7
requirements/tests.txt Normal file
View File

@ -0,0 +1,7 @@
-r production.txt
asynctest
coverage
pytest
pytest-asyncio
pytest-cov
pytest-mock