From: Tim Van Steenburgh Date: Mon, 23 May 2016 21:09:16 +0000 (-0400) Subject: actually add tests/ X-Git-Tag: 0.1.0~98 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=df4c118fd593a46fc4e9f967367ca94c03d69ef4;p=osm%2FN2VC.git actually add tests/ --- diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/client/__init__.py b/tests/client/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/client/test_connection.py b/tests/client/test_connection.py new file mode 100644 index 0000000..187dcb0 --- /dev/null +++ b/tests/client/test_connection.py @@ -0,0 +1,29 @@ +import asyncio +import unittest +import subprocess + +import pytest + +from juju.client.connection import Connection + + +def is_bootstrapped(): + result = subprocess.run(['juju', 'switch'], stdout=subprocess.PIPE) + print(result.stdout) + return ( + result.returncode == 0 and + len(result.stdout.decode().strip()) > 0) + +bootstrapped = pytest.mark.skipif( + not is_bootstrapped(), + reason='bootstrapped Juju environment required') + + +@bootstrapped +class FunctionalConnectionTest(unittest.TestCase): + def test_connect_current(self): + loop = asyncio.get_event_loop() + conn = loop.run_until_complete( + Connection.connect_current()) + + self.assertIsInstance(conn, Connection)