Lines Matching refs:mock

23 import mock
77 fake_cfg = mock.MagicMock()
81 fake_cfg, mock.MagicMock())
82 self.compute_client._service = mock.MagicMock()
99 resource_mock = mock.MagicMock()
100 mock_api = mock.MagicMock()
102 self.compute_client._service.globalOperations = mock.MagicMock(
105 self.compute_client._service.zoneOperations = mock.MagicMock(
108 self.compute_client._service.regionOperations = mock.MagicMock(
110 resource_mock.get = mock.MagicMock(return_value=mock_api)
111 mock_api.execute = mock.MagicMock(return_value=mock_result)
160 @mock.patch.object(errors, "GceOperationTimeoutError")
161 @mock.patch.object(utils, "PollAndWait")
164 mock_error = mock.MagicMock()
182 resource_mock = mock.MagicMock()
183 mock_api = mock.MagicMock()
184 self.compute_client._service.images = mock.MagicMock(
186 resource_mock.get = mock.MagicMock(return_value=mock_api)
187 mock_api.execute = mock.MagicMock(return_value={"name": self.IMAGE})
194 resource_mock = mock.MagicMock()
195 mock_api = mock.MagicMock()
196 self.compute_client._service.images = mock.MagicMock(
198 resource_mock.get = mock.MagicMock(return_value=mock_api)
199 mock_api.execute = mock.MagicMock(return_value={"name": self.IMAGE_OTHER})
218 resource_mock = mock.MagicMock()
219 self.compute_client._service.images = mock.MagicMock(
221 resource_mock.insert = mock.MagicMock()
228 operation=mock.ANY,
243 resource_mock = mock.MagicMock()
244 self.compute_client._service.images = mock.MagicMock(
246 resource_mock.insert = mock.MagicMock()
253 operation=mock.ANY,
269 resource_mock = mock.MagicMock()
270 self.compute_client._service.images = mock.MagicMock(
272 resource_mock.insert = mock.MagicMock()
279 operation=mock.ANY,
283 @mock.patch.object(gcompute_client.ComputeClient, "GetImage")
286 with mock.patch.object(self.compute_client._service, "images",
287 return_value=mock.MagicMock(
288 setLabels=mock.MagicMock())) as _:
326 @mock.patch.object(gcompute_client.ComputeClient, "DeleteImage")
327 @mock.patch.object(gcompute_client.ComputeClient, "CheckImageExists",
329 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation",
333 resource_mock = mock.MagicMock()
334 self.compute_client._service.images = mock.MagicMock(
336 resource_mock.insert = mock.MagicMock()
354 operation=mock.ANY,
361 resource_mock = mock.MagicMock()
362 mock_api = mock.MagicMock()
363 self.compute_client._service.images = mock.MagicMock(
365 resource_mock.get = mock.MagicMock(return_value=mock_api)
366 mock_api.execute = mock.MagicMock(return_value={"name": self.IMAGE})
371 resource_mock = mock.MagicMock()
372 mock_api = mock.MagicMock()
373 self.compute_client._service.images = mock.MagicMock(
375 resource_mock.get = mock.MagicMock(return_value=mock_api)
376 mock_api.execute = mock.MagicMock(
380 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
383 resource_mock = mock.MagicMock()
384 self.compute_client._service.images = mock.MagicMock(
386 resource_mock.delete = mock.MagicMock()
403 request_id=rid, response=mock.MagicMock(), exception=None)
404 mock_batch = mock.MagicMock()
411 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
416 mock_api = mock.MagicMock()
417 resource_mock = mock.MagicMock()
418 self.compute_client._service.images = mock.MagicMock(
420 resource_mock.delete = mock.MagicMock(return_value=mock_api)
426 mock.call(project=PROJECT, image="fake_image_1"),
427 mock.call(project=PROJECT, image="fake_image_2")
446 resource_mock = mock.MagicMock()
447 self.compute_client._service.images = mock.MagicMock(
449 resource_mock.list = mock.MagicMock()
452 mock.call(project=PROJECT, filter=None, pageToken=None),
453 mock.call(project=PROJECT, filter=None, pageToken=fake_token)
463 resource_mock = mock.MagicMock()
464 self.compute_client._service.images = mock.MagicMock(
466 resource_mock.list = mock.MagicMock()
470 mock.call(project="fake-project-2", filter=None, pageToken=None)]
476 resource_mock = mock.MagicMock()
477 mock_api = mock.MagicMock()
478 self.compute_client._service.instances = mock.MagicMock(
480 resource_mock.get = mock.MagicMock(return_value=mock_api)
481 mock_api.execute = mock.MagicMock(return_value={"name": self.INSTANCE})
496 resource_mock = mock.MagicMock()
497 self.compute_client._service.instances = mock.MagicMock(
499 resource_mock.aggregatedList = mock.MagicMock()
502 mock.call(
553 @mock.patch.object(gcompute_client.ComputeClient, "GetImage")
554 @mock.patch.object(gcompute_client.ComputeClient, "GetNetworkUrl")
555 @mock.patch.object(gcompute_client.ComputeClient, "GetSubnetworkUrl")
556 @mock.patch.object(gcompute_client.ComputeClient, "GetMachineType")
557 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
558 @mock.patch("getpass.getuser", return_value="fake_user")
567 resource_mock = mock.MagicMock()
568 self.compute_client._service.instances = mock.MagicMock(
570 resource_mock.insert = mock.MagicMock()
620 mock.ANY,
625 @mock.patch.object(gcompute_client.ComputeClient, "GetImage")
626 @mock.patch.object(gcompute_client.ComputeClient, "GetNetworkUrl")
627 @mock.patch.object(gcompute_client.ComputeClient, "GetSubnetworkUrl")
628 @mock.patch.object(gcompute_client.ComputeClient, "GetMachineType")
629 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
630 @mock.patch("getpass.getuser", return_value="fake_user")
643 resource_mock = mock.MagicMock()
644 self.compute_client._service.instances = mock.MagicMock(
646 resource_mock.insert = mock.MagicMock()
698 mock.ANY,
702 @mock.patch.object(gcompute_client.ComputeClient, "GetAcceleratorUrl")
703 @mock.patch.object(gcompute_client.ComputeClient, "GetImage")
704 @mock.patch.object(gcompute_client.ComputeClient, "GetNetworkUrl")
705 @mock.patch.object(gcompute_client.ComputeClient, "GetSubnetworkUrl")
706 @mock.patch.object(gcompute_client.ComputeClient, "GetMachineType")
707 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
708 @mock.patch("getpass.getuser", return_value="fake_user")
719 resource_mock = mock.MagicMock()
720 self.compute_client._service.instances = mock.MagicMock(
722 resource_mock.insert = mock.MagicMock()
771 mock.ANY, operation_scope=gcompute_client.OperationScope.ZONE,
774 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
777 resource_mock = mock.MagicMock()
778 self.compute_client._service.instances = mock.MagicMock(
780 resource_mock.delete = mock.MagicMock()
786 mock.ANY,
790 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
795 mock_api = mock.MagicMock()
796 resource_mock = mock.MagicMock()
797 self.compute_client._service.instances = mock.MagicMock(
799 resource_mock.delete = mock.MagicMock(return_value=mock_api)
803 mock.call(
807 mock.call(
823 resource_mock = mock.MagicMock()
824 self.compute_client._service.disks = mock.MagicMock(
826 resource_mock.insert = mock.MagicMock()
850 resource_mock = mock.MagicMock()
851 self.compute_client._service.disks = mock.MagicMock(
853 resource_mock.insert = mock.MagicMock()
877 resource_mock = mock.MagicMock()
878 self.compute_client._service.disks = mock.MagicMock(
880 resource_mock.insert = mock.MagicMock()
908 resource_mock = mock.MagicMock()
909 self.compute_client._service.disks = mock.MagicMock(
911 resource_mock.insert = mock.MagicMock()
934 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
937 resource_mock = mock.MagicMock()
938 self.compute_client._service.instances = mock.MagicMock(
940 resource_mock.attachDisk = mock.MagicMock()
954 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
957 resource_mock = mock.MagicMock()
958 self.compute_client._service.instances = mock.MagicMock(
960 resource_mock.detachDisk = mock.MagicMock()
969 @mock.patch.object(gcompute_client.ComputeClient, "GetAcceleratorUrl")
970 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
974 resource_mock = mock.MagicMock()
975 self.compute_client._service.instances = mock.MagicMock(
977 resource_mock.attachAccelerator = mock.MagicMock()
992 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
996 action = mock.MagicMock(return_value=mock.MagicMock())
1000 calls = [mock.call(instance="fake_instance_1"),
1001 mock.call(instance="fake_instance_2")]
1008 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
1011 resource_mock = mock.MagicMock()
1012 self.compute_client._service.instances = mock.MagicMock(
1014 resource_mock.reset = mock.MagicMock()
1020 mock.ANY,
1051 [mock.call("name1", self.ZONE), mock.call("name2", self.ZONE)])
1090 resource_mock = mock.MagicMock()
1091 mock_api = mock.MagicMock()
1092 self.compute_client._service.machineTypes = mock.MagicMock(
1094 resource_mock.get = mock.MagicMock(return_value=mock_api)
1095 mock_api.execute = mock.MagicMock(
1111 resource_mock = mock.MagicMock()
1112 mock_api = mock.MagicMock()
1113 self.compute_client._service.instances = mock.MagicMock(
1115 resource_mock.getSerialPortOutput = mock.MagicMock(
1117 mock_api.execute = mock.MagicMock(return_value=response)
1252 m = mock.mock_open(read_data=self.SSHKEY)
1253 with mock.patch.object(six.moves.builtins, "open", m):
1287 resource_mock = mock.MagicMock()
1288 self.compute_client.SetInstanceMetadata = mock.MagicMock(
1372 m = mock.mock_open(read_data=self.SSHKEY)
1376 resource_mock = mock.MagicMock()
1377 self.compute_client._service.instances = mock.MagicMock(
1379 resource_mock.setMetadata = mock.MagicMock()
1385 with mock.patch.object(six.moves.builtins, "open", m):
1401 with mock.patch.object(six.moves.builtins, "open", m):
1408 @mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
1413 mock_api = mock.MagicMock()
1414 resource_mock = mock.MagicMock()
1415 self.compute_client._service.disks = mock.MagicMock(
1417 resource_mock.delete = mock.MagicMock(return_value=mock_api)
1423 mock.call(project=PROJECT, disk="fake_disk_1", zone=self.ZONE),
1424 mock.call(project=PROJECT, disk="fake_disk_2", zone=self.ZONE)
1442 sentinel = mock.MagicMock()
1508 resource_mock = mock.MagicMock()
1509 mock_api = mock.MagicMock()
1510 self.compute_client._service.disks = mock.MagicMock(
1512 resource_mock.get = mock.MagicMock(return_value=mock_api)
1513 mock_api.execute = mock.MagicMock(return_value={"name": self.DISK})