~juju-qa/juju-ci-tools/trunk

« back to all changes in this revision

Viewing changes to jujupy/tests/test_client.py

  • Committer: Christopher Lee
  • Date: 2017-03-23 04:28:57 UTC
  • mto: (1938.5.4 juju_timing_reporting)
  • mto: This revision was merged to the branch mainline in revision 1982.
  • Revision ID: chris.lee@canonical.com-20170323042857-up64h0vev2qyzfcr
Update tests to reflect new returns from command wrappers (and ModelClient.juju).

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
from tests import (
102
102
    assert_juju_call,
103
103
    client_past_deadline,
 
104
    make_fake_juju_return,
104
105
    FakeHomeTestCase,
105
106
    FakePopen,
106
107
    observable_temp_file,
705
706
        env = JujuData('foo', {'type': 'foo', 'region': 'baz'})
706
707
        client = ModelClient(env, '2.0-zeta1', None)
707
708
        with observable_temp_file() as config_file:
708
 
            with patch.object(client, 'juju') as mock:
 
709
            with patch_juju_call(client) as mock:
709
710
                client.bootstrap(upload_tools=True)
710
711
        mock.assert_called_with(
711
712
            'bootstrap', (
718
719
        env = JujuData('foo', {'type': 'foo', 'region': 'baz'})
719
720
        client = ModelClient(env, '2.0-zeta1', None)
720
721
        with observable_temp_file() as config_file:
721
 
            with patch.object(client, 'juju') as mock:
 
722
            with patch_juju_call(client) as mock:
722
723
                client.bootstrap(credential='credential_name')
723
724
        mock.assert_called_with(
724
725
            'bootstrap', (
731
732
    def test_bootstrap_bootstrap_series(self):
732
733
        env = JujuData('foo', {'type': 'bar', 'region': 'baz'})
733
734
        client = ModelClient(env, '2.0-zeta1', None)
734
 
        with patch.object(client, 'juju') as mock:
 
735
        with patch_juju_call(client) as mock:
735
736
            with observable_temp_file() as config_file:
736
737
                client.bootstrap(bootstrap_series='angsty')
737
738
        mock.assert_called_with(
745
746
    def test_bootstrap_auto_upgrade(self):
746
747
        env = JujuData('foo', {'type': 'bar', 'region': 'baz'})
747
748
        client = ModelClient(env, '2.0-zeta1', None)
748
 
        with patch.object(client, 'juju') as mock:
 
749
        with patch_juju_call(client) as mock:
749
750
            with observable_temp_file() as config_file:
750
751
                client.bootstrap(auto_upgrade=True)
751
752
        mock.assert_called_with(
758
759
    def test_bootstrap_no_gui(self):
759
760
        env = JujuData('foo', {'type': 'bar', 'region': 'baz'})
760
761
        client = ModelClient(env, '2.0-zeta1', None)
761
 
        with patch.object(client, 'juju') as mock:
 
762
        with patch_juju_call(client) as mock:
762
763
            with observable_temp_file() as config_file:
763
764
                client.bootstrap(no_gui=True)
764
765
        mock.assert_called_with(
771
772
    def test_bootstrap_metadata(self):
772
773
        env = JujuData('foo', {'type': 'bar', 'region': 'baz'})
773
774
        client = ModelClient(env, '2.0-zeta1', None)
774
 
        with patch.object(client, 'juju') as mock:
 
775
        with patch_juju_call(client) as mock:
775
776
            with observable_temp_file() as config_file:
776
777
                client.bootstrap(metadata_source='/var/test-source')
777
778
        mock.assert_called_with(
865
866
        client = ModelClient(model_data, None, None)
866
867
        with patch.object(client, 'get_jes_command',
867
868
                          return_value=jes_command):
868
 
                with patch.object(controller_client, 'juju') as ccj_mock:
 
869
                with patch_juju_call(controller_client) as ccj_mock:
869
870
                    with observable_temp_file() as config_file:
870
871
                        controller_client.add_model(model_data)
871
872
        ccj_mock.assert_called_once_with(
877
878
        client.bootstrap()
878
879
        client.env.controller.explicit_region = True
879
880
        model = client.env.clone('new-model')
880
 
        with patch.object(client._backend, 'juju') as juju_mock:
 
881
        with patch_juju_call(client._backend) as juju_mock:
881
882
            with observable_temp_file() as config_file:
882
883
                client.add_model(model)
883
884
        juju_mock.assert_called_once_with('add-model', (
889
890
    def test_add_model_by_name(self):
890
891
        client = fake_juju_client()
891
892
        client.bootstrap()
892
 
        with patch.object(client._backend, 'juju') as juju_mock:
 
893
        with patch_juju_call(client._backend) as juju_mock:
893
894
            with observable_temp_file() as config_file:
894
895
                client.add_model('new-model')
895
896
        juju_mock.assert_called_once_with('add-model', (
931
932
 
932
933
    def test_kill_controller(self):
933
934
        client = ModelClient(JujuData('foo', {'type': 'ec2'}), None, None)
934
 
        with patch.object(client, 'juju') as juju_mock:
 
935
        with patch_juju_call(client) as juju_mock:
935
936
            client.kill_controller()
936
937
        juju_mock.assert_called_once_with(
937
938
            'kill-controller', ('foo', '-y'), check=False, include_e=False,
939
940
 
940
941
    def test_kill_controller_check(self):
941
942
        client = ModelClient(JujuData('foo', {'type': 'ec2'}), None, None)
942
 
        with patch.object(client, 'juju') as juju_mock:
 
943
        with patch_juju_call(client) as juju_mock:
943
944
            client.kill_controller(check=True)
944
945
        juju_mock.assert_called_once_with(
945
946
            'kill-controller', ('foo', '-y'), check=True, include_e=False,
949
950
        client = ModelClient(JujuData('foo', {'type': 'azure'}), None, None)
950
951
        with patch.object(client, 'get_jes_command',
951
952
                          return_value=jes_command):
952
 
            with patch.object(client, 'juju') as juju_mock:
 
953
            with patch_juju_call(client) as juju_mock:
953
954
                client.kill_controller()
954
955
        juju_mock.assert_called_once_with(
955
956
            kill_command, ('foo', '-y'), check=False, include_e=False,
957
958
 
958
959
    def test_kill_controller_gce(self):
959
960
        client = ModelClient(JujuData('foo', {'type': 'gce'}), None, None)
960
 
        with patch.object(client, 'juju') as juju_mock:
 
961
        with patch_juju_call(client) as juju_mock:
961
962
            client.kill_controller()
962
963
        juju_mock.assert_called_once_with(
963
964
            'kill-controller', ('foo', '-y'), check=False, include_e=False,
965
966
 
966
967
    def test_destroy_controller(self):
967
968
        client = ModelClient(JujuData('foo', {'type': 'ec2'}), None, None)
968
 
        with patch.object(client, 'juju') as juju_mock:
 
969
        with patch_juju_call(client) as juju_mock:
969
970
            client.destroy_controller()
970
971
        juju_mock.assert_called_once_with(
971
972
            'destroy-controller', ('foo', '-y'), include_e=False,
973
974
 
974
975
    def test_destroy_controller_all_models(self):
975
976
        client = ModelClient(JujuData('foo', {'type': 'ec2'}), None, None)
976
 
        with patch.object(client, 'juju') as juju_mock:
 
977
        with patch_juju_call(client) as juju_mock:
977
978
            client.destroy_controller(all_models=True)
978
979
        juju_mock.assert_called_once_with(
979
980
            'destroy-controller', ('foo', '-y', '--destroy-all-models'),
991
992
                                  side_effect=raise_error) as mock:
992
993
                    yield mock
993
994
            else:
994
 
                with patch.object(target, attribute, autospec=True) as mock:
 
995
                with patch.object(
 
996
                        target, attribute, autospec=True,
 
997
                        return_value=make_fake_juju_return()) as mock:
995
998
                    yield mock
996
999
 
997
1000
        with patch_raise(client, 'destroy_controller', destroy_raises
1222
1225
    def test_deploy_non_joyent(self):
1223
1226
        env = ModelClient(
1224
1227
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1225
 
        with patch.object(env, 'juju') as mock_juju:
 
1228
        with patch_juju_call(env) as mock_juju:
1226
1229
            env.deploy('mondogb')
1227
1230
        mock_juju.assert_called_with('deploy', ('mondogb',))
1228
1231
 
1229
1232
    def test_deploy_joyent(self):
1230
1233
        env = ModelClient(
1231
1234
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1232
 
        with patch.object(env, 'juju') as mock_juju:
 
1235
        with patch_juju_call(env) as mock_juju:
1233
1236
            env.deploy('mondogb')
1234
1237
        mock_juju.assert_called_with('deploy', ('mondogb',))
1235
1238
 
1236
1239
    def test_deploy_repository(self):
1237
1240
        env = ModelClient(
1238
1241
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1239
 
        with patch.object(env, 'juju') as mock_juju:
 
1242
        with patch_juju_call(env) as mock_juju:
1240
1243
            env.deploy('/home/jrandom/repo/mongodb')
1241
1244
        mock_juju.assert_called_with(
1242
1245
            'deploy', ('/home/jrandom/repo/mongodb',))
1244
1247
    def test_deploy_to(self):
1245
1248
        env = ModelClient(
1246
1249
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1247
 
        with patch.object(env, 'juju') as mock_juju:
 
1250
        with patch_juju_call(env) as mock_juju:
1248
1251
            env.deploy('mondogb', to='0')
1249
1252
        mock_juju.assert_called_with(
1250
1253
            'deploy', ('mondogb', '--to', '0'))
1252
1255
    def test_deploy_service(self):
1253
1256
        env = ModelClient(
1254
1257
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1255
 
        with patch.object(env, 'juju') as mock_juju:
 
1258
        with patch_juju_call(env) as mock_juju:
1256
1259
            env.deploy('local:mondogb', service='my-mondogb')
1257
1260
        mock_juju.assert_called_with(
1258
1261
            'deploy', ('local:mondogb', 'my-mondogb',))
1260
1263
    def test_deploy_force(self):
1261
1264
        env = ModelClient(
1262
1265
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1263
 
        with patch.object(env, 'juju') as mock_juju:
 
1266
        with patch_juju_call(env) as mock_juju:
1264
1267
            env.deploy('local:mondogb', force=True)
1265
1268
        mock_juju.assert_called_with('deploy', ('local:mondogb', '--force',))
1266
1269
 
1267
1270
    def test_deploy_series(self):
1268
1271
        env = ModelClient(
1269
1272
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1270
 
        with patch.object(env, 'juju') as mock_juju:
 
1273
        with patch_juju_call(env) as mock_juju:
1271
1274
            env.deploy('local:blah', series='xenial')
1272
1275
        mock_juju.assert_called_with(
1273
1276
            'deploy', ('local:blah', '--series', 'xenial'))
1275
1278
    def test_deploy_multiple(self):
1276
1279
        env = ModelClient(
1277
1280
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1278
 
        with patch.object(env, 'juju') as mock_juju:
 
1281
        with patch_juju_call(env) as mock_juju:
1279
1282
            env.deploy('local:blah', num=2)
1280
1283
        mock_juju.assert_called_with(
1281
1284
            'deploy', ('local:blah', '-n', '2'))
1282
1285
 
1283
1286
    def test_deploy_resource(self):
1284
1287
        env = ModelClient(JujuData('foo', {'type': 'local'}), None, None)
1285
 
        with patch.object(env, 'juju') as mock_juju:
 
1288
        with patch_juju_call(env) as mock_juju:
1286
1289
            env.deploy('local:blah', resource='foo=/path/dir')
1287
1290
        mock_juju.assert_called_with(
1288
1291
            'deploy', ('local:blah', '--resource', 'foo=/path/dir'))
1290
1293
    def test_deploy_storage(self):
1291
1294
        env = EnvJujuClient1X(
1292
1295
            SimpleEnvironment('foo', {'type': 'local'}), '1.234-76', None)
1293
 
        with patch.object(env, 'juju') as mock_juju:
 
1296
        with patch_juju_call(env) as mock_juju:
1294
1297
            env.deploy('mondogb', storage='rootfs,1G')
1295
1298
        mock_juju.assert_called_with(
1296
1299
            'deploy', ('mondogb', '--storage', 'rootfs,1G'))
1298
1301
    def test_deploy_constraints(self):
1299
1302
        env = EnvJujuClient1X(
1300
1303
            SimpleEnvironment('foo', {'type': 'local'}), '1.234-76', None)
1301
 
        with patch.object(env, 'juju') as mock_juju:
 
1304
        with patch_juju_call(env) as mock_juju:
1302
1305
            env.deploy('mondogb', constraints='virt-type=kvm')
1303
1306
        mock_juju.assert_called_with(
1304
1307
            'deploy', ('mondogb', '--constraints', 'virt-type=kvm'))
1305
1308
 
1306
1309
    def test_deploy_bind(self):
1307
1310
        env = ModelClient(JujuData('foo', {'type': 'local'}), None, None)
1308
 
        with patch.object(env, 'juju') as mock_juju:
 
1311
        with patch_juju_call(env) as mock_juju:
1309
1312
            env.deploy('mydb', bind='backspace')
1310
1313
        mock_juju.assert_called_with('deploy', ('mydb', '--bind', 'backspace'))
1311
1314
 
1312
1315
    def test_deploy_aliased(self):
1313
1316
        env = ModelClient(JujuData('foo', {'type': 'local'}), None, None)
1314
 
        with patch.object(env, 'juju') as mock_juju:
 
1317
        with patch_juju_call(env) as mock_juju:
1315
1318
            env.deploy('local:blah', alias='blah-blah')
1316
1319
        mock_juju.assert_called_with(
1317
1320
            'deploy', ('local:blah', 'blah-blah'))
1318
1321
 
1319
1322
    def test_attach(self):
1320
1323
        env = ModelClient(JujuData('foo', {'type': 'local'}), None, None)
1321
 
        with patch.object(env, 'juju') as mock_juju:
 
1324
        with patch_juju_call(env) as mock_juju:
1322
1325
            env.attach('foo', resource='foo=/path/dir')
1323
1326
        mock_juju.assert_called_with('attach', ('foo', 'foo=/path/dir'))
1324
1327
 
1386
1389
    def test_deploy_bundle_2x(self):
1387
1390
        client = ModelClient(JujuData('an_env', None),
1388
1391
                             '1.23-series-arch', None)
1389
 
        with patch.object(client, 'juju') as mock_juju:
 
1392
        with patch_juju_call(client) as mock_juju:
1390
1393
            client.deploy_bundle('bundle:~juju-qa/some-bundle')
1391
1394
        mock_juju.assert_called_with(
1392
1395
            'deploy', ('bundle:~juju-qa/some-bundle'), timeout=3600)
1394
1397
    def test_deploy_bundle_template(self):
1395
1398
        client = ModelClient(JujuData('an_env', None),
1396
1399
                             '1.23-series-arch', None)
1397
 
        with patch.object(client, 'juju') as mock_juju:
 
1400
        with patch_juju_call(client) as mock_juju:
1398
1401
            client.deploy_bundle('bundle:~juju-qa/some-{container}-bundle')
1399
1402
        mock_juju.assert_called_with(
1400
1403
            'deploy', ('bundle:~juju-qa/some-lxd-bundle'), timeout=3600)
1402
1405
    def test_upgrade_charm(self):
1403
1406
        env = ModelClient(
1404
1407
            JujuData('foo', {'type': 'local'}), '2.34-74', None)
1405
 
        with patch.object(env, 'juju') as mock_juju:
 
1408
        with patch_juju_call(env) as mock_juju:
1406
1409
            env.upgrade_charm('foo-service',
1407
1410
                              '/bar/repository/angsty/mongodb')
1408
1411
        mock_juju.assert_called_once_with(
1412
1415
    def test_remove_service(self):
1413
1416
        env = ModelClient(
1414
1417
            JujuData('foo', {'type': 'local'}), '1.234-76', None)
1415
 
        with patch.object(env, 'juju') as mock_juju:
 
1418
        with patch_juju_call(env) as mock_juju:
1416
1419
            env.remove_service('mondogb')
1417
1420
        mock_juju.assert_called_with('remove-application', ('mondogb',))
1418
1421
 
1581
1584
 
1582
1585
    def test_remove_machine(self):
1583
1586
        client = fake_juju_client()
1584
 
        with patch.object(client._backend, 'juju') as juju_mock:
 
1587
        with patch_juju_call(client._backend) as juju_mock:
1585
1588
            condition = client.remove_machine('0')
1586
1589
        call = backend_call(
1587
1590
            client, 'remove-machine', ('0',), 'name:name')
1590
1593
 
1591
1594
    def test_remove_machine_force(self):
1592
1595
        client = fake_juju_client()
1593
 
        with patch.object(client._backend, 'juju') as juju_mock:
 
1596
        with patch_juju_call(client._backend) as juju_mock:
1594
1597
            client.remove_machine('0', force=True)
1595
1598
        call = backend_call(
1596
1599
            client, 'remove-machine', ('--force', '0'), 'name:name')
1985
1988
 
1986
1989
    def test_list_models(self):
1987
1990
        client = ModelClient(JujuData('foo'), None, None)
1988
 
        with patch.object(client, 'juju') as j_mock:
 
1991
        with patch_juju_call(client) as j_mock:
1989
1992
            client.list_models()
1990
1993
        j_mock.assert_called_once_with(
1991
1994
            'list-models', ('-c', 'foo'), include_e=False)
2197
2200
 
2198
2201
    def test_list_controllers(self):
2199
2202
        client = ModelClient(JujuData('foo'), None, None)
2200
 
        with patch.object(client, 'juju') as j_mock:
 
2203
        with patch_juju_call(client) as j_mock:
2201
2204
            client.list_controllers()
2202
2205
        j_mock.assert_called_once_with('list-controllers', (), include_e=False)
2203
2206
 
2665
2668
 
2666
2669
    def test_set_model_constraints(self):
2667
2670
        client = ModelClient(JujuData('bar', {}), None, '/foo')
2668
 
        with patch.object(client, 'juju') as juju_mock:
 
2671
        with patch_juju_call(client) as juju_mock:
2669
2672
            client.set_model_constraints({'bar': 'baz'})
2670
2673
        juju_mock.assert_called_once_with('set-model-constraints',
2671
2674
                                          ('bar=baz',))
2951
2954
    def test_restore_backup(self):
2952
2955
        env = JujuData('qux')
2953
2956
        client = ModelClient(env, None, '/foobar/baz')
2954
 
        with patch.object(client, 'juju') as gjo_mock:
 
2957
        with patch_juju_call(client) as gjo_mock:
2955
2958
            client.restore_backup('quxx')
2956
2959
        gjo_mock.assert_called_once_with(
2957
2960
            'restore-backup',
3233
3236
 
3234
3237
    def test_set_config(self):
3235
3238
        client = ModelClient(JujuData('bar', {}), None, '/foo')
3236
 
        with patch.object(client, 'juju') as juju_mock:
 
3239
        with patch_juju_call(client) as juju_mock:
3237
3240
            client.set_config('foo', {'bar': 'baz'})
3238
3241
        juju_mock.assert_called_once_with('config', ('foo', 'bar=baz'))
3239
3242
 
3288
3291
 
3289
3292
    def test_upgrade_mongo(self):
3290
3293
        client = ModelClient(JujuData('bar', {}), None, '/foo')
3291
 
        with patch.object(client, 'juju') as juju_mock:
 
3294
        with patch_juju_call(client) as juju_mock:
3292
3295
            client.upgrade_mongo()
3293
3296
        juju_mock.assert_called_once_with('upgrade-mongo', ())
3294
3297
 
3333
3336
        default_model = fake_client.model_name
3334
3337
        default_controller = fake_client.env.controller.name
3335
3338
 
3336
 
        with patch.object(fake_client, 'juju', return_value=True):
 
3339
        with patch_juju_call(fake_client):
3337
3340
            fake_client.revoke(username)
3338
3341
            fake_client.juju.assert_called_with('revoke',
3339
3342
                                                ('-c', default_controller,
3413
3416
        env = JujuData('foo')
3414
3417
        username = 'fakeuser'
3415
3418
        client = ModelClient(env, None, None)
3416
 
        with patch.object(client, 'juju') as mock:
 
3419
        with patch_juju_call(client) as mock:
3417
3420
            client.disable_user(username)
3418
3421
        mock.assert_called_with(
3419
3422
            'disable-user', ('-c', 'foo', 'fakeuser'), include_e=False)
3422
3425
        env = JujuData('foo')
3423
3426
        username = 'fakeuser'
3424
3427
        client = ModelClient(env, None, None)
3425
 
        with patch.object(client, 'juju') as mock:
 
3428
        with patch_juju_call(client) as mock:
3426
3429
            client.enable_user(username)
3427
3430
        mock.assert_called_with(
3428
3431
            'enable-user', ('-c', 'foo', 'fakeuser'), include_e=False)
3430
3433
    def test_logout(self):
3431
3434
        env = JujuData('foo')
3432
3435
        client = ModelClient(env, None, None)
3433
 
        with patch.object(client, 'juju') as mock:
 
3436
        with patch_juju_call(client) as mock:
3434
3437
            client.logout()
3435
3438
        mock.assert_called_with(
3436
3439
            'logout', ('-c', 'foo'), include_e=False)
3670
3673
 
3671
3674
    def test_disable_command(self):
3672
3675
        client = ModelClient(JujuData('foo'), None, None)
3673
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3676
        with patch_juju_call(client) as mock:
3674
3677
            client.disable_command('all', 'message')
3675
3678
        mock.assert_called_once_with('disable-command', ('all', 'message'))
3676
3679
 
3677
3680
    def test_enable_command(self):
3678
3681
        client = ModelClient(JujuData('foo'), None, None)
3679
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3682
        with patch_juju_call(client) as mock:
3680
3683
            client.enable_command('all')
3681
3684
        mock.assert_called_once_with('enable-command', 'all')
3682
3685
 
3683
3686
    def test_sync_tools(self):
3684
3687
        client = ModelClient(JujuData('foo'), None, None)
3685
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3688
        with patch_juju_call(client) as mock:
3686
3689
            client.sync_tools()
3687
3690
        mock.assert_called_once_with('sync-tools', ())
3688
3691
 
3689
3692
    def test_sync_tools_local_dir(self):
3690
3693
        client = ModelClient(JujuData('foo'), None, None)
3691
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3694
        with patch_juju_call(client) as mock:
3692
3695
            client.sync_tools('/agents')
3693
3696
        mock.assert_called_once_with('sync-tools', ('--local-dir', '/agents'),
3694
3697
                                     include_e=False)
3695
3698
 
3696
3699
    def test_generate_tool(self):
3697
3700
        client = ModelClient(JujuData('foo'), None, None)
3698
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3701
        with patch_juju_call(client) as mock:
3699
3702
            client.generate_tool('/agents')
3700
3703
        mock.assert_called_once_with('metadata',
3701
3704
                                     ('generate-tools', '-d', '/agents'),
3703
3706
 
3704
3707
    def test_generate_tool_with_stream(self):
3705
3708
        client = ModelClient(JujuData('foo'), None, None)
3706
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3709
        with patch_juju_call(client) as mock:
3707
3710
            client.generate_tool('/agents', "testing")
3708
3711
        mock.assert_called_once_with(
3709
3712
            'metadata', ('generate-tools', '-d', '/agents',
3711
3714
 
3712
3715
    def test_add_cloud(self):
3713
3716
        client = ModelClient(JujuData('foo'), None, None)
3714
 
        with patch.object(client, 'juju', autospec=True) as mock:
 
3717
        with patch_juju_call(client) as mock:
3715
3718
            client.add_cloud('localhost', 'cfile')
3716
3719
        mock.assert_called_once_with('add-cloud',
3717
3720
                                     ('--replace', 'localhost', 'cfile'),
3720
3723
    def test_switch(self):
3721
3724
        def run_switch_test(expect, model=None, controller=None):
3722
3725
            client = ModelClient(JujuData('foo'), None, None)
3723
 
            with patch.object(client, 'juju', autospec=True) as mock:
 
3726
            with patch_juju_call(client) as mock:
3724
3727
                client.switch(model=model, controller=controller)
3725
3728
            mock.assert_called_once_with('switch', (expect,), include_e=False)
3726
3729
        run_switch_test('default', 'default')