From df4c118fd593a46fc4e9f967367ca94c03d69ef4 Mon Sep 17 00:00:00 2001 From: Tim Van Steenburgh Date: Mon, 23 May 2016 17:09:16 -0400 Subject: [PATCH] actually add tests/ --- tests/__init__.py | 0 tests/client/__init__.py | 0 tests/client/test_connection.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/client/__init__.py create mode 100644 tests/client/test_connection.py 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) -- 2.25.1