Add more code coverage

This commit is contained in:
vrde 2017-04-11 16:34:50 +02:00
parent 3758d458ce
commit a673d9c6ef
No known key found for this signature in database
GPG Key ID: 6581C7C39B3D397D
1 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import json
import random
from unittest.mock import patch
import pytest
import asyncio
@ -114,6 +115,19 @@ def test_capped_queue(loop):
assert async_queue.qsize() == 0
@patch('threading.Thread.start')
@patch('aiohttp.web.run_app')
@patch('bigchaindb.web.websocket_server.init_app')
@patch('asyncio.get_event_loop', return_value='event-loop')
@patch('asyncio.Queue', return_value='event-queue')
def test_start_creates_an_event_loop(queue_mock, get_event_loop_mock, init_app_mock, run_app_mock, thread_start_mock):
from bigchaindb.web.websocket_server import start
start(None)
init_app_mock.assert_called_with('event-queue', loop='event-loop')
@asyncio.coroutine
def test_websocket_string_event(test_client, loop):
from bigchaindb.web.websocket_server import init_app, POISON_PILL, EVENTS_ENDPOINT