def create_start_maintenance_result(self, skip_hosts=None): host_statuses = self.create_host_statuses(MaintenanceMode.SCHEDULED, skip_hosts) response = self.create_simple_success_response() response.result.startMaintenanceResult = StartMaintenanceResult( statuses=set(host_statuses)) return response
def test_start_maintenance(self, mock_api): mock_api.return_value = Response( responseCode=ResponseCode.OK, result=Result(startMaintenanceResult=StartMaintenanceResult( statuses=set([HostStatus()])))) maintenance = HostMaintenance(DEFAULT_CLUSTER, 'quiet') maintenance.start_maintenance(TEST_HOSTNAMES) mock_api.assert_called_once_with(Hosts(set(TEST_HOSTNAMES)))