X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=tests%2Fintegration%2Ftest_connection.py;h=67dfb2e3ca4d1b816c22a400267c2d0708bfdfcb;hb=refs%2Ftags%2F0.4.0;hp=9c617594c7ee78fffb15e37dd85a685d78499dcc;hpb=f33ed4d2e1efc9e479445da842d08256ceaccac8;p=osm%2FN2VC.git diff --git a/tests/integration/test_connection.py b/tests/integration/test_connection.py index 9c61759..67dfb2e 100644 --- a/tests/integration/test_connection.py +++ b/tests/integration/test_connection.py @@ -1,6 +1,7 @@ import pytest from juju.client.connection import Connection +from juju.client import client from .. import base @@ -12,3 +13,47 @@ async def test_connect_current(event_loop): assert isinstance(conn, Connection) await conn.close() + + +@base.bootstrapped +@pytest.mark.asyncio +async def test_monitor(event_loop): + + async with base.CleanModel(): + conn = await Connection.connect_current() + + assert conn.monitor.status == 'connected' + await conn.close() + + assert conn.monitor.status == 'disconnected' + + +@base.bootstrapped +@pytest.mark.asyncio +async def test_monitor_catches_error(event_loop): + + async with base.CleanModel(): + conn = await Connection.connect_current() + + assert conn.monitor.status == 'connected' + await conn.ws.close() + + assert conn.monitor.status == 'error' + + await conn.close() + + +@base.bootstrapped +@pytest.mark.asyncio +async def test_full_status(event_loop): + async with base.CleanModel() as model: + app = await model.deploy( + 'ubuntu-0', + application_name='ubuntu', + series='trusty', + channel='stable', + ) + + c = client.ClientFacade.from_connection(model.connection) + + status = await c.FullStatus(None)