actually add tests/
authorTim Van Steenburgh <tvansteenburgh@gmail.com>
Mon, 23 May 2016 21:09:16 +0000 (17:09 -0400)
committerTim Van Steenburgh <tvansteenburgh@gmail.com>
Mon, 23 May 2016 21:09:16 +0000 (17:09 -0400)
tests/__init__.py [new file with mode: 0644]
tests/client/__init__.py [new file with mode: 0644]
tests/client/test_connection.py [new file with mode: 0644]

diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/client/__init__.py b/tests/client/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/client/test_connection.py b/tests/client/test_connection.py
new file mode 100644 (file)
index 0000000..187dcb0
--- /dev/null
@@ -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)