~sinzui/juju-ci-tools/login-u

« back to all changes in this revision

Viewing changes to jujupy/tests/test_version_client.py

  • Committer: Aaron Bentley
  • Date: 2017-02-27 18:25:14 UTC
  • mfrom: (1912.2.1 load-bootstrap-config)
  • Revision ID: aaron.bentley@canonical.com-20170227182514-qtzckpgftc2mn0lx
Initialise JujuData from bootstrap-config.yaml

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    )
34
34
from jujupy.client import (
35
35
    CannotConnectEnv,
 
36
    get_bootstrap_config_path,
36
37
    GroupReporter,
37
38
    StatusItem,
38
39
    StatusNotMet,
75
76
    )
76
77
from jujupy.utility import (
77
78
    get_timeout_path,
 
79
    temp_dir,
78
80
    )
79
81
 
80
82
 
230
232
            client_class = get_client_class(backend.version)
231
233
            with patch.object(client_class, 'default_backend',
232
234
                              return_value=backend) as db_mock:
233
 
                client = client_for_existing(backend.full_path, '/juju-data')
 
235
                with temp_dir() as juju_data:
 
236
                    with open(get_bootstrap_config_path(juju_data), 'w') as f:
 
237
                        yaml.safe_dump({'controllers': {'ctrl1': {
 
238
                            'controller-config': {
 
239
                                },
 
240
                            'model-config': {
 
241
                                },
 
242
                            'cloud': 'cloud1',
 
243
                            'region': 'region1',
 
244
                            'type': 'provider1',
 
245
                            }}}, f)
 
246
                    client = client_for_existing(backend.full_path, juju_data)
234
247
        self.assertEqual(client.model_name, 'model1')
235
248
        self.assertEqual(client.env.controller.name, 'ctrl1')
 
249
        self.assertEqual(client.env.get_cloud(), 'cloud1')
 
250
        self.assertEqual(client.env.get_region(), 'region1')
 
251
        self.assertEqual(client.env.provider, 'provider1')
236
252
        gv_mock.assert_called_once_with(backend.full_path)
237
253
        db_mock.assert_called_once_with(backend.full_path, backend.version,
238
254
                                        set(), debug=False, soft_deadline=None)