From ce580da6a62a6fa51b162e5b402093eaadf63b6b Mon Sep 17 00:00:00 2001 From: Marion Le Borgne Date: Tue, 28 Aug 2018 13:36:18 -0700 Subject: [PATCH] FIX: tests --- README.rst | 2 +- requirements/analytics.txt | 1 - requirements/core.txt | 1 + tests/unit/openbci_test.py | 13 +++++++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index eecfa95..3e001f2 100644 --- a/README.rst +++ b/README.rst @@ -48,7 +48,7 @@ Installing from source Running the tests ----------------- - +Analytics modules need to be installed prior to running the tests. See instalation section. :: python setup.py test diff --git a/requirements/analytics.txt b/requirements/analytics.txt index 9f36827..4426b4d 100644 --- a/requirements/analytics.txt +++ b/requirements/analytics.txt @@ -1,3 +1,2 @@ scipy==0.18.1 -numpy==1.11.2 mne==0.10.0 diff --git a/requirements/core.txt b/requirements/core.txt index 5f64881..539ad04 100644 --- a/requirements/core.txt +++ b/requirements/core.txt @@ -2,3 +2,4 @@ simplejson==3.8.2 pika==0.11.0 requests[security]==2.18.1 pyserial==2.7 +numpy==1.11.2 diff --git a/tests/unit/openbci_test.py b/tests/unit/openbci_test.py index a3d884e..ca1ff46 100644 --- a/tests/unit/openbci_test.py +++ b/tests/unit/openbci_test.py @@ -35,6 +35,17 @@ def inWaiting(self): return False +class MockHTTPResponse(object): + + status_code = 200 + + def json(self): + return {'vhost': 'mock_vhost'} + + +def mock_requests_get(vhost_info_url, verify): + return MockHTTPResponse() + def mock_start(self, callback_functions): """ @@ -133,6 +144,7 @@ def test_OpenBCIConnector(self): board.start(callbacks) + @patch('requests.get', mock_requests_get) @patch('pika.BlockingConnection', MockBlockingConnection) def test_PikaPublisher(self): @@ -171,6 +183,7 @@ def test_PikaPublisher(self): self.assertEqual(published_message, expected_message) + @patch('requests.get', mock_requests_get) @patch('serial.Serial', MockSerial) @patch('pika.BlockingConnection', MockBlockingConnection) @patch('cloudbrain.connectors.openbci.OpenBCIConnector.start',