__pycache__/
.tox/
*.egg-info/
+.cache/
-from libjuju.facade import Type, ReturnMapping
+from juju.client.facade import Type, ReturnMapping
class Action(Type):
_toSchema = {'name': 'name', 'receiver': 'receiver', 'parameters': 'parameters', 'tag': 'tag'}
schemas = json.loads(Path(options.schema).read_text("utf-8"))
capture = codegen.CodeWriter()
capture.write("""
-from libjuju.facade import Type, ReturnMapping
+from juju.client.facade import Type, ReturnMapping
""")
schemas = [Schema(s) for s in schemas]
--- /dev/null
+import subprocess
+
+import pytest
+
+
+def is_bootstrapped():
+ result = subprocess.run(['juju', 'switch'], stdout=subprocess.PIPE)
+ return (
+ result.returncode == 0 and
+ len(result.stdout.decode().strip()) > 0)
+
+bootstrapped = pytest.mark.skipif(
+ not is_bootstrapped(),
+ reason='bootstrapped Juju environment required')
--- /dev/null
+import asyncio
+import unittest
+
+from juju.client.connection import Connection
+from juju.client.client import UserManager, Entity
+
+from ..base import bootstrapped
+
+
+@bootstrapped
+class UserManagerTest(unittest.TestCase):
+ def test_connect_current(self):
+ loop = asyncio.get_event_loop()
+ conn = loop.run_until_complete(
+ Connection.connect_current())
+
+ um = UserManager()
+ um.connect(conn)
+ result = loop.run_until_complete(
+ um.UserInfo([Entity('user-admin')], True))
+
+ assert result
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')
+from ..base import bootstrapped
@bootstrapped