Native charm support
[osm/N2VC.git] / modules / libjuju / tests / unit / test_client.py
1 """
2 Tests for generated client code
3
4 """
5
6 import mock
7 from juju.client import client
8
9
10 def test_basics():
11 assert client.CLIENTS
12 for i in range(1, 5): # Assert versions 1-4 in client dict
13 assert str(i) in client.CLIENTS
14
15
16 def test_from_connection():
17 connection = mock.Mock()
18 connection.facades = {"Action": 2}
19 action_facade = client.ActionFacade.from_connection(connection)
20 assert action_facade
21
22
23 def test_to_json():
24 uml = client.UserModelList([client.UserModel()])
25 assert uml.to_json() == ('{"user-models": [{"last-connection": null, '
26 '"model": null}]}')