New N2VC interface + updated libjuju
This commit introduces the Python3 N2VC module, which acts as a standard
interface to the VCA.
The goal of this is to provide a common way for modules to interface
with the VCA.
- Updated libjuju from 0.6.1 to 0.7.3
Signed-off-by: Adam Israel <adam.israel@canonical.com>
Change-Id: Ide70fb5ae5797eb6486de24653dc09a23f9c009e
diff --git a/modules/libjuju/tests/unit/test_connection.py b/modules/libjuju/tests/unit/test_connection.py
index f69b8d6..0925d84 100644
--- a/modules/libjuju/tests/unit/test_connection.py
+++ b/modules/libjuju/tests/unit/test_connection.py
@@ -1,13 +1,14 @@
import asyncio
import json
-import mock
-import pytest
from collections import deque
+import mock
+from juju.client.connection import Connection
from websockets.exceptions import ConnectionClosed
+import pytest
+
from .. import base
-from juju.client.connection import Connection
class WebsocketMock:
@@ -31,7 +32,6 @@
@pytest.mark.asyncio
async def test_out_of_order(event_loop):
- con = Connection(*[None]*4)
ws = WebsocketMock([
{'request-id': 1},
{'request-id': 3},
@@ -42,13 +42,24 @@
{'request-id': 2},
{'request-id': 3},
]
- con._get_sll = mock.MagicMock()
+ minimal_facades = [{'name': 'Pinger', 'versions': [1]}]
+ con = None
try:
- with mock.patch('websockets.connect', base.AsyncMock(return_value=ws)):
- await con.open()
+ with \
+ mock.patch('websockets.connect', base.AsyncMock(return_value=ws)), \
+ mock.patch(
+ 'juju.client.connection.Connection.login',
+ base.AsyncMock(return_value={'response': {
+ 'facades': minimal_facades,
+ }}),
+ ), \
+ mock.patch('juju.client.connection.Connection._get_ssl'), \
+ mock.patch('juju.client.connection.Connection._pinger', base.AsyncMock()):
+ con = await Connection.connect('0.1.2.3:999')
actual_responses = []
for i in range(3):
actual_responses.append(await con.rpc({'version': 1}))
assert actual_responses == expected_responses
finally:
- await con.close()
+ if con:
+ await con.close()