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