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