def test_get_a_block_calls_requests(self, mock_requests_post): mock_requests_post.return_value = Mock(status_code=200) d = Demux() d._get_block(555) # assertions mock_requests_post.assert_called_with( 'https://node2.eosphere.io/v1/chain/get_block', json={'block_num_or_id': 555})
def test_invalid_post_raises_exception(self, mock_requests_post): mock_requests_post.return_value = Mock(status_code=500) d = Demux() with pytest.raises(UnknownBlockError): d._get_block(9999999999)