| library googleapis.bigquery.v2.test; |
| |
| import "dart:core" as core; |
| import "dart:collection" as collection; |
| import "dart:async" as async; |
| import "dart:convert" as convert; |
| |
| import 'package:http/http.dart' as http; |
| import 'package:http/testing.dart' as http_testing; |
| import 'package:unittest/unittest.dart' as unittest; |
| import 'package:googleapis/common/common.dart' as common; |
| import 'package:googleapis/src/common_internal.dart' as common_internal; |
| import '../common/common_internal_test.dart' as common_test; |
| |
| import 'package:googleapis/bigquery/v2.dart' as api; |
| |
| |
| |
| core.int buildCounterDatasetAccess = 0; |
| buildDatasetAccess() { |
| var o = new api.DatasetAccess(); |
| buildCounterDatasetAccess++; |
| if (buildCounterDatasetAccess < 3) { |
| o.domain = "foo"; |
| o.groupByEmail = "foo"; |
| o.role = "foo"; |
| o.specialGroup = "foo"; |
| o.userByEmail = "foo"; |
| o.view = buildTableReference(); |
| } |
| buildCounterDatasetAccess--; |
| return o; |
| } |
| |
| checkDatasetAccess(api.DatasetAccess o) { |
| buildCounterDatasetAccess++; |
| if (buildCounterDatasetAccess < 3) { |
| unittest.expect(o.domain, unittest.equals('foo')); |
| unittest.expect(o.groupByEmail, unittest.equals('foo')); |
| unittest.expect(o.role, unittest.equals('foo')); |
| unittest.expect(o.specialGroup, unittest.equals('foo')); |
| unittest.expect(o.userByEmail, unittest.equals('foo')); |
| checkTableReference(o.view); |
| } |
| buildCounterDatasetAccess--; |
| } |
| |
| buildUnnamed1013() { |
| var o = new core.List<api.DatasetAccess>(); |
| o.add(buildDatasetAccess()); |
| o.add(buildDatasetAccess()); |
| return o; |
| } |
| |
| checkUnnamed1013(core.List<api.DatasetAccess> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkDatasetAccess(o[0]); |
| checkDatasetAccess(o[1]); |
| } |
| |
| core.int buildCounterDataset = 0; |
| buildDataset() { |
| var o = new api.Dataset(); |
| buildCounterDataset++; |
| if (buildCounterDataset < 3) { |
| o.access = buildUnnamed1013(); |
| o.creationTime = "foo"; |
| o.datasetReference = buildDatasetReference(); |
| o.description = "foo"; |
| o.etag = "foo"; |
| o.friendlyName = "foo"; |
| o.id = "foo"; |
| o.kind = "foo"; |
| o.lastModifiedTime = "foo"; |
| o.selfLink = "foo"; |
| } |
| buildCounterDataset--; |
| return o; |
| } |
| |
| checkDataset(api.Dataset o) { |
| buildCounterDataset++; |
| if (buildCounterDataset < 3) { |
| checkUnnamed1013(o.access); |
| unittest.expect(o.creationTime, unittest.equals('foo')); |
| checkDatasetReference(o.datasetReference); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.friendlyName, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.lastModifiedTime, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| } |
| buildCounterDataset--; |
| } |
| |
| core.int buildCounterDatasetListDatasets = 0; |
| buildDatasetListDatasets() { |
| var o = new api.DatasetListDatasets(); |
| buildCounterDatasetListDatasets++; |
| if (buildCounterDatasetListDatasets < 3) { |
| o.datasetReference = buildDatasetReference(); |
| o.friendlyName = "foo"; |
| o.id = "foo"; |
| o.kind = "foo"; |
| } |
| buildCounterDatasetListDatasets--; |
| return o; |
| } |
| |
| checkDatasetListDatasets(api.DatasetListDatasets o) { |
| buildCounterDatasetListDatasets++; |
| if (buildCounterDatasetListDatasets < 3) { |
| checkDatasetReference(o.datasetReference); |
| unittest.expect(o.friendlyName, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| } |
| buildCounterDatasetListDatasets--; |
| } |
| |
| buildUnnamed1014() { |
| var o = new core.List<api.DatasetListDatasets>(); |
| o.add(buildDatasetListDatasets()); |
| o.add(buildDatasetListDatasets()); |
| return o; |
| } |
| |
| checkUnnamed1014(core.List<api.DatasetListDatasets> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkDatasetListDatasets(o[0]); |
| checkDatasetListDatasets(o[1]); |
| } |
| |
| core.int buildCounterDatasetList = 0; |
| buildDatasetList() { |
| var o = new api.DatasetList(); |
| buildCounterDatasetList++; |
| if (buildCounterDatasetList < 3) { |
| o.datasets = buildUnnamed1014(); |
| o.etag = "foo"; |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| } |
| buildCounterDatasetList--; |
| return o; |
| } |
| |
| checkDatasetList(api.DatasetList o) { |
| buildCounterDatasetList++; |
| if (buildCounterDatasetList < 3) { |
| checkUnnamed1014(o.datasets); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterDatasetList--; |
| } |
| |
| core.int buildCounterDatasetReference = 0; |
| buildDatasetReference() { |
| var o = new api.DatasetReference(); |
| buildCounterDatasetReference++; |
| if (buildCounterDatasetReference < 3) { |
| o.datasetId = "foo"; |
| o.projectId = "foo"; |
| } |
| buildCounterDatasetReference--; |
| return o; |
| } |
| |
| checkDatasetReference(api.DatasetReference o) { |
| buildCounterDatasetReference++; |
| if (buildCounterDatasetReference < 3) { |
| unittest.expect(o.datasetId, unittest.equals('foo')); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| } |
| buildCounterDatasetReference--; |
| } |
| |
| core.int buildCounterErrorProto = 0; |
| buildErrorProto() { |
| var o = new api.ErrorProto(); |
| buildCounterErrorProto++; |
| if (buildCounterErrorProto < 3) { |
| o.debugInfo = "foo"; |
| o.location = "foo"; |
| o.message = "foo"; |
| o.reason = "foo"; |
| } |
| buildCounterErrorProto--; |
| return o; |
| } |
| |
| checkErrorProto(api.ErrorProto o) { |
| buildCounterErrorProto++; |
| if (buildCounterErrorProto < 3) { |
| unittest.expect(o.debugInfo, unittest.equals('foo')); |
| unittest.expect(o.location, unittest.equals('foo')); |
| unittest.expect(o.message, unittest.equals('foo')); |
| unittest.expect(o.reason, unittest.equals('foo')); |
| } |
| buildCounterErrorProto--; |
| } |
| |
| buildUnnamed1015() { |
| var o = new core.List<api.TableRow>(); |
| o.add(buildTableRow()); |
| o.add(buildTableRow()); |
| return o; |
| } |
| |
| checkUnnamed1015(core.List<api.TableRow> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableRow(o[0]); |
| checkTableRow(o[1]); |
| } |
| |
| core.int buildCounterGetQueryResultsResponse = 0; |
| buildGetQueryResultsResponse() { |
| var o = new api.GetQueryResultsResponse(); |
| buildCounterGetQueryResultsResponse++; |
| if (buildCounterGetQueryResultsResponse < 3) { |
| o.cacheHit = true; |
| o.etag = "foo"; |
| o.jobComplete = true; |
| o.jobReference = buildJobReference(); |
| o.kind = "foo"; |
| o.pageToken = "foo"; |
| o.rows = buildUnnamed1015(); |
| o.schema = buildTableSchema(); |
| o.totalRows = "foo"; |
| } |
| buildCounterGetQueryResultsResponse--; |
| return o; |
| } |
| |
| checkGetQueryResultsResponse(api.GetQueryResultsResponse o) { |
| buildCounterGetQueryResultsResponse++; |
| if (buildCounterGetQueryResultsResponse < 3) { |
| unittest.expect(o.cacheHit, unittest.isTrue); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.jobComplete, unittest.isTrue); |
| checkJobReference(o.jobReference); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.pageToken, unittest.equals('foo')); |
| checkUnnamed1015(o.rows); |
| checkTableSchema(o.schema); |
| unittest.expect(o.totalRows, unittest.equals('foo')); |
| } |
| buildCounterGetQueryResultsResponse--; |
| } |
| |
| core.int buildCounterJob = 0; |
| buildJob() { |
| var o = new api.Job(); |
| buildCounterJob++; |
| if (buildCounterJob < 3) { |
| o.configuration = buildJobConfiguration(); |
| o.etag = "foo"; |
| o.id = "foo"; |
| o.jobReference = buildJobReference(); |
| o.kind = "foo"; |
| o.selfLink = "foo"; |
| o.statistics = buildJobStatistics(); |
| o.status = buildJobStatus(); |
| } |
| buildCounterJob--; |
| return o; |
| } |
| |
| checkJob(api.Job o) { |
| buildCounterJob++; |
| if (buildCounterJob < 3) { |
| checkJobConfiguration(o.configuration); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkJobReference(o.jobReference); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| checkJobStatistics(o.statistics); |
| checkJobStatus(o.status); |
| } |
| buildCounterJob--; |
| } |
| |
| core.int buildCounterJobConfiguration = 0; |
| buildJobConfiguration() { |
| var o = new api.JobConfiguration(); |
| buildCounterJobConfiguration++; |
| if (buildCounterJobConfiguration < 3) { |
| o.copy = buildJobConfigurationTableCopy(); |
| o.dryRun = true; |
| o.extract = buildJobConfigurationExtract(); |
| o.link = buildJobConfigurationLink(); |
| o.load = buildJobConfigurationLoad(); |
| o.query = buildJobConfigurationQuery(); |
| } |
| buildCounterJobConfiguration--; |
| return o; |
| } |
| |
| checkJobConfiguration(api.JobConfiguration o) { |
| buildCounterJobConfiguration++; |
| if (buildCounterJobConfiguration < 3) { |
| checkJobConfigurationTableCopy(o.copy); |
| unittest.expect(o.dryRun, unittest.isTrue); |
| checkJobConfigurationExtract(o.extract); |
| checkJobConfigurationLink(o.link); |
| checkJobConfigurationLoad(o.load); |
| checkJobConfigurationQuery(o.query); |
| } |
| buildCounterJobConfiguration--; |
| } |
| |
| buildUnnamed1016() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed1016(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterJobConfigurationExtract = 0; |
| buildJobConfigurationExtract() { |
| var o = new api.JobConfigurationExtract(); |
| buildCounterJobConfigurationExtract++; |
| if (buildCounterJobConfigurationExtract < 3) { |
| o.compression = "foo"; |
| o.destinationFormat = "foo"; |
| o.destinationUri = "foo"; |
| o.destinationUris = buildUnnamed1016(); |
| o.fieldDelimiter = "foo"; |
| o.printHeader = true; |
| o.sourceTable = buildTableReference(); |
| } |
| buildCounterJobConfigurationExtract--; |
| return o; |
| } |
| |
| checkJobConfigurationExtract(api.JobConfigurationExtract o) { |
| buildCounterJobConfigurationExtract++; |
| if (buildCounterJobConfigurationExtract < 3) { |
| unittest.expect(o.compression, unittest.equals('foo')); |
| unittest.expect(o.destinationFormat, unittest.equals('foo')); |
| unittest.expect(o.destinationUri, unittest.equals('foo')); |
| checkUnnamed1016(o.destinationUris); |
| unittest.expect(o.fieldDelimiter, unittest.equals('foo')); |
| unittest.expect(o.printHeader, unittest.isTrue); |
| checkTableReference(o.sourceTable); |
| } |
| buildCounterJobConfigurationExtract--; |
| } |
| |
| buildUnnamed1017() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed1017(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterJobConfigurationLink = 0; |
| buildJobConfigurationLink() { |
| var o = new api.JobConfigurationLink(); |
| buildCounterJobConfigurationLink++; |
| if (buildCounterJobConfigurationLink < 3) { |
| o.createDisposition = "foo"; |
| o.destinationTable = buildTableReference(); |
| o.sourceUri = buildUnnamed1017(); |
| o.writeDisposition = "foo"; |
| } |
| buildCounterJobConfigurationLink--; |
| return o; |
| } |
| |
| checkJobConfigurationLink(api.JobConfigurationLink o) { |
| buildCounterJobConfigurationLink++; |
| if (buildCounterJobConfigurationLink < 3) { |
| unittest.expect(o.createDisposition, unittest.equals('foo')); |
| checkTableReference(o.destinationTable); |
| checkUnnamed1017(o.sourceUri); |
| unittest.expect(o.writeDisposition, unittest.equals('foo')); |
| } |
| buildCounterJobConfigurationLink--; |
| } |
| |
| buildUnnamed1018() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed1018(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterJobConfigurationLoad = 0; |
| buildJobConfigurationLoad() { |
| var o = new api.JobConfigurationLoad(); |
| buildCounterJobConfigurationLoad++; |
| if (buildCounterJobConfigurationLoad < 3) { |
| o.allowJaggedRows = true; |
| o.allowQuotedNewlines = true; |
| o.createDisposition = "foo"; |
| o.destinationTable = buildTableReference(); |
| o.encoding = "foo"; |
| o.fieldDelimiter = "foo"; |
| o.ignoreUnknownValues = true; |
| o.maxBadRecords = 42; |
| o.quote = "foo"; |
| o.schema = buildTableSchema(); |
| o.schemaInline = "foo"; |
| o.schemaInlineFormat = "foo"; |
| o.skipLeadingRows = 42; |
| o.sourceFormat = "foo"; |
| o.sourceUris = buildUnnamed1018(); |
| o.writeDisposition = "foo"; |
| } |
| buildCounterJobConfigurationLoad--; |
| return o; |
| } |
| |
| checkJobConfigurationLoad(api.JobConfigurationLoad o) { |
| buildCounterJobConfigurationLoad++; |
| if (buildCounterJobConfigurationLoad < 3) { |
| unittest.expect(o.allowJaggedRows, unittest.isTrue); |
| unittest.expect(o.allowQuotedNewlines, unittest.isTrue); |
| unittest.expect(o.createDisposition, unittest.equals('foo')); |
| checkTableReference(o.destinationTable); |
| unittest.expect(o.encoding, unittest.equals('foo')); |
| unittest.expect(o.fieldDelimiter, unittest.equals('foo')); |
| unittest.expect(o.ignoreUnknownValues, unittest.isTrue); |
| unittest.expect(o.maxBadRecords, unittest.equals(42)); |
| unittest.expect(o.quote, unittest.equals('foo')); |
| checkTableSchema(o.schema); |
| unittest.expect(o.schemaInline, unittest.equals('foo')); |
| unittest.expect(o.schemaInlineFormat, unittest.equals('foo')); |
| unittest.expect(o.skipLeadingRows, unittest.equals(42)); |
| unittest.expect(o.sourceFormat, unittest.equals('foo')); |
| checkUnnamed1018(o.sourceUris); |
| unittest.expect(o.writeDisposition, unittest.equals('foo')); |
| } |
| buildCounterJobConfigurationLoad--; |
| } |
| |
| core.int buildCounterJobConfigurationQuery = 0; |
| buildJobConfigurationQuery() { |
| var o = new api.JobConfigurationQuery(); |
| buildCounterJobConfigurationQuery++; |
| if (buildCounterJobConfigurationQuery < 3) { |
| o.allowLargeResults = true; |
| o.createDisposition = "foo"; |
| o.defaultDataset = buildDatasetReference(); |
| o.destinationTable = buildTableReference(); |
| o.flattenResults = true; |
| o.preserveNulls = true; |
| o.priority = "foo"; |
| o.query = "foo"; |
| o.useQueryCache = true; |
| o.writeDisposition = "foo"; |
| } |
| buildCounterJobConfigurationQuery--; |
| return o; |
| } |
| |
| checkJobConfigurationQuery(api.JobConfigurationQuery o) { |
| buildCounterJobConfigurationQuery++; |
| if (buildCounterJobConfigurationQuery < 3) { |
| unittest.expect(o.allowLargeResults, unittest.isTrue); |
| unittest.expect(o.createDisposition, unittest.equals('foo')); |
| checkDatasetReference(o.defaultDataset); |
| checkTableReference(o.destinationTable); |
| unittest.expect(o.flattenResults, unittest.isTrue); |
| unittest.expect(o.preserveNulls, unittest.isTrue); |
| unittest.expect(o.priority, unittest.equals('foo')); |
| unittest.expect(o.query, unittest.equals('foo')); |
| unittest.expect(o.useQueryCache, unittest.isTrue); |
| unittest.expect(o.writeDisposition, unittest.equals('foo')); |
| } |
| buildCounterJobConfigurationQuery--; |
| } |
| |
| buildUnnamed1019() { |
| var o = new core.List<api.TableReference>(); |
| o.add(buildTableReference()); |
| o.add(buildTableReference()); |
| return o; |
| } |
| |
| checkUnnamed1019(core.List<api.TableReference> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableReference(o[0]); |
| checkTableReference(o[1]); |
| } |
| |
| core.int buildCounterJobConfigurationTableCopy = 0; |
| buildJobConfigurationTableCopy() { |
| var o = new api.JobConfigurationTableCopy(); |
| buildCounterJobConfigurationTableCopy++; |
| if (buildCounterJobConfigurationTableCopy < 3) { |
| o.createDisposition = "foo"; |
| o.destinationTable = buildTableReference(); |
| o.sourceTable = buildTableReference(); |
| o.sourceTables = buildUnnamed1019(); |
| o.writeDisposition = "foo"; |
| } |
| buildCounterJobConfigurationTableCopy--; |
| return o; |
| } |
| |
| checkJobConfigurationTableCopy(api.JobConfigurationTableCopy o) { |
| buildCounterJobConfigurationTableCopy++; |
| if (buildCounterJobConfigurationTableCopy < 3) { |
| unittest.expect(o.createDisposition, unittest.equals('foo')); |
| checkTableReference(o.destinationTable); |
| checkTableReference(o.sourceTable); |
| checkUnnamed1019(o.sourceTables); |
| unittest.expect(o.writeDisposition, unittest.equals('foo')); |
| } |
| buildCounterJobConfigurationTableCopy--; |
| } |
| |
| core.int buildCounterJobListJobs = 0; |
| buildJobListJobs() { |
| var o = new api.JobListJobs(); |
| buildCounterJobListJobs++; |
| if (buildCounterJobListJobs < 3) { |
| o.configuration = buildJobConfiguration(); |
| o.errorResult = buildErrorProto(); |
| o.id = "foo"; |
| o.jobReference = buildJobReference(); |
| o.kind = "foo"; |
| o.state = "foo"; |
| o.statistics = buildJobStatistics(); |
| o.status = buildJobStatus(); |
| o.userEmail = "foo"; |
| } |
| buildCounterJobListJobs--; |
| return o; |
| } |
| |
| checkJobListJobs(api.JobListJobs o) { |
| buildCounterJobListJobs++; |
| if (buildCounterJobListJobs < 3) { |
| checkJobConfiguration(o.configuration); |
| checkErrorProto(o.errorResult); |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkJobReference(o.jobReference); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.state, unittest.equals('foo')); |
| checkJobStatistics(o.statistics); |
| checkJobStatus(o.status); |
| unittest.expect(o.userEmail, unittest.equals('foo')); |
| } |
| buildCounterJobListJobs--; |
| } |
| |
| buildUnnamed1020() { |
| var o = new core.List<api.JobListJobs>(); |
| o.add(buildJobListJobs()); |
| o.add(buildJobListJobs()); |
| return o; |
| } |
| |
| checkUnnamed1020(core.List<api.JobListJobs> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkJobListJobs(o[0]); |
| checkJobListJobs(o[1]); |
| } |
| |
| core.int buildCounterJobList = 0; |
| buildJobList() { |
| var o = new api.JobList(); |
| buildCounterJobList++; |
| if (buildCounterJobList < 3) { |
| o.etag = "foo"; |
| o.jobs = buildUnnamed1020(); |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| o.totalItems = 42; |
| } |
| buildCounterJobList--; |
| return o; |
| } |
| |
| checkJobList(api.JobList o) { |
| buildCounterJobList++; |
| if (buildCounterJobList < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| checkUnnamed1020(o.jobs); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| unittest.expect(o.totalItems, unittest.equals(42)); |
| } |
| buildCounterJobList--; |
| } |
| |
| core.int buildCounterJobReference = 0; |
| buildJobReference() { |
| var o = new api.JobReference(); |
| buildCounterJobReference++; |
| if (buildCounterJobReference < 3) { |
| o.jobId = "foo"; |
| o.projectId = "foo"; |
| } |
| buildCounterJobReference--; |
| return o; |
| } |
| |
| checkJobReference(api.JobReference o) { |
| buildCounterJobReference++; |
| if (buildCounterJobReference < 3) { |
| unittest.expect(o.jobId, unittest.equals('foo')); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| } |
| buildCounterJobReference--; |
| } |
| |
| core.int buildCounterJobStatistics = 0; |
| buildJobStatistics() { |
| var o = new api.JobStatistics(); |
| buildCounterJobStatistics++; |
| if (buildCounterJobStatistics < 3) { |
| o.creationTime = "foo"; |
| o.endTime = "foo"; |
| o.load = buildJobStatistics3(); |
| o.query = buildJobStatistics2(); |
| o.startTime = "foo"; |
| o.totalBytesProcessed = "foo"; |
| } |
| buildCounterJobStatistics--; |
| return o; |
| } |
| |
| checkJobStatistics(api.JobStatistics o) { |
| buildCounterJobStatistics++; |
| if (buildCounterJobStatistics < 3) { |
| unittest.expect(o.creationTime, unittest.equals('foo')); |
| unittest.expect(o.endTime, unittest.equals('foo')); |
| checkJobStatistics3(o.load); |
| checkJobStatistics2(o.query); |
| unittest.expect(o.startTime, unittest.equals('foo')); |
| unittest.expect(o.totalBytesProcessed, unittest.equals('foo')); |
| } |
| buildCounterJobStatistics--; |
| } |
| |
| core.int buildCounterJobStatistics2 = 0; |
| buildJobStatistics2() { |
| var o = new api.JobStatistics2(); |
| buildCounterJobStatistics2++; |
| if (buildCounterJobStatistics2 < 3) { |
| o.cacheHit = true; |
| o.totalBytesProcessed = "foo"; |
| } |
| buildCounterJobStatistics2--; |
| return o; |
| } |
| |
| checkJobStatistics2(api.JobStatistics2 o) { |
| buildCounterJobStatistics2++; |
| if (buildCounterJobStatistics2 < 3) { |
| unittest.expect(o.cacheHit, unittest.isTrue); |
| unittest.expect(o.totalBytesProcessed, unittest.equals('foo')); |
| } |
| buildCounterJobStatistics2--; |
| } |
| |
| core.int buildCounterJobStatistics3 = 0; |
| buildJobStatistics3() { |
| var o = new api.JobStatistics3(); |
| buildCounterJobStatistics3++; |
| if (buildCounterJobStatistics3 < 3) { |
| o.inputFileBytes = "foo"; |
| o.inputFiles = "foo"; |
| o.outputBytes = "foo"; |
| o.outputRows = "foo"; |
| } |
| buildCounterJobStatistics3--; |
| return o; |
| } |
| |
| checkJobStatistics3(api.JobStatistics3 o) { |
| buildCounterJobStatistics3++; |
| if (buildCounterJobStatistics3 < 3) { |
| unittest.expect(o.inputFileBytes, unittest.equals('foo')); |
| unittest.expect(o.inputFiles, unittest.equals('foo')); |
| unittest.expect(o.outputBytes, unittest.equals('foo')); |
| unittest.expect(o.outputRows, unittest.equals('foo')); |
| } |
| buildCounterJobStatistics3--; |
| } |
| |
| buildUnnamed1021() { |
| var o = new core.List<api.ErrorProto>(); |
| o.add(buildErrorProto()); |
| o.add(buildErrorProto()); |
| return o; |
| } |
| |
| checkUnnamed1021(core.List<api.ErrorProto> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkErrorProto(o[0]); |
| checkErrorProto(o[1]); |
| } |
| |
| core.int buildCounterJobStatus = 0; |
| buildJobStatus() { |
| var o = new api.JobStatus(); |
| buildCounterJobStatus++; |
| if (buildCounterJobStatus < 3) { |
| o.errorResult = buildErrorProto(); |
| o.errors = buildUnnamed1021(); |
| o.state = "foo"; |
| } |
| buildCounterJobStatus--; |
| return o; |
| } |
| |
| checkJobStatus(api.JobStatus o) { |
| buildCounterJobStatus++; |
| if (buildCounterJobStatus < 3) { |
| checkErrorProto(o.errorResult); |
| checkUnnamed1021(o.errors); |
| unittest.expect(o.state, unittest.equals('foo')); |
| } |
| buildCounterJobStatus--; |
| } |
| |
| buildJsonObject() { |
| var o = new api.JsonObject(); |
| o["a"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| o["b"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| return o; |
| } |
| |
| checkJsonObject(api.JsonObject o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted1 = (o["a"]) as core.Map; unittest.expect(casted1, unittest.hasLength(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], unittest.equals('foo')); |
| var casted2 = (o["b"]) as core.Map; unittest.expect(casted2, unittest.hasLength(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterProjectListProjects = 0; |
| buildProjectListProjects() { |
| var o = new api.ProjectListProjects(); |
| buildCounterProjectListProjects++; |
| if (buildCounterProjectListProjects < 3) { |
| o.friendlyName = "foo"; |
| o.id = "foo"; |
| o.kind = "foo"; |
| o.numericId = "foo"; |
| o.projectReference = buildProjectReference(); |
| } |
| buildCounterProjectListProjects--; |
| return o; |
| } |
| |
| checkProjectListProjects(api.ProjectListProjects o) { |
| buildCounterProjectListProjects++; |
| if (buildCounterProjectListProjects < 3) { |
| unittest.expect(o.friendlyName, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.numericId, unittest.equals('foo')); |
| checkProjectReference(o.projectReference); |
| } |
| buildCounterProjectListProjects--; |
| } |
| |
| buildUnnamed1022() { |
| var o = new core.List<api.ProjectListProjects>(); |
| o.add(buildProjectListProjects()); |
| o.add(buildProjectListProjects()); |
| return o; |
| } |
| |
| checkUnnamed1022(core.List<api.ProjectListProjects> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkProjectListProjects(o[0]); |
| checkProjectListProjects(o[1]); |
| } |
| |
| core.int buildCounterProjectList = 0; |
| buildProjectList() { |
| var o = new api.ProjectList(); |
| buildCounterProjectList++; |
| if (buildCounterProjectList < 3) { |
| o.etag = "foo"; |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| o.projects = buildUnnamed1022(); |
| o.totalItems = 42; |
| } |
| buildCounterProjectList--; |
| return o; |
| } |
| |
| checkProjectList(api.ProjectList o) { |
| buildCounterProjectList++; |
| if (buildCounterProjectList < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed1022(o.projects); |
| unittest.expect(o.totalItems, unittest.equals(42)); |
| } |
| buildCounterProjectList--; |
| } |
| |
| core.int buildCounterProjectReference = 0; |
| buildProjectReference() { |
| var o = new api.ProjectReference(); |
| buildCounterProjectReference++; |
| if (buildCounterProjectReference < 3) { |
| o.projectId = "foo"; |
| } |
| buildCounterProjectReference--; |
| return o; |
| } |
| |
| checkProjectReference(api.ProjectReference o) { |
| buildCounterProjectReference++; |
| if (buildCounterProjectReference < 3) { |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| } |
| buildCounterProjectReference--; |
| } |
| |
| core.int buildCounterQueryRequest = 0; |
| buildQueryRequest() { |
| var o = new api.QueryRequest(); |
| buildCounterQueryRequest++; |
| if (buildCounterQueryRequest < 3) { |
| o.defaultDataset = buildDatasetReference(); |
| o.dryRun = true; |
| o.kind = "foo"; |
| o.maxResults = 42; |
| o.preserveNulls = true; |
| o.query = "foo"; |
| o.timeoutMs = 42; |
| o.useQueryCache = true; |
| } |
| buildCounterQueryRequest--; |
| return o; |
| } |
| |
| checkQueryRequest(api.QueryRequest o) { |
| buildCounterQueryRequest++; |
| if (buildCounterQueryRequest < 3) { |
| checkDatasetReference(o.defaultDataset); |
| unittest.expect(o.dryRun, unittest.isTrue); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.maxResults, unittest.equals(42)); |
| unittest.expect(o.preserveNulls, unittest.isTrue); |
| unittest.expect(o.query, unittest.equals('foo')); |
| unittest.expect(o.timeoutMs, unittest.equals(42)); |
| unittest.expect(o.useQueryCache, unittest.isTrue); |
| } |
| buildCounterQueryRequest--; |
| } |
| |
| buildUnnamed1023() { |
| var o = new core.List<api.TableRow>(); |
| o.add(buildTableRow()); |
| o.add(buildTableRow()); |
| return o; |
| } |
| |
| checkUnnamed1023(core.List<api.TableRow> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableRow(o[0]); |
| checkTableRow(o[1]); |
| } |
| |
| core.int buildCounterQueryResponse = 0; |
| buildQueryResponse() { |
| var o = new api.QueryResponse(); |
| buildCounterQueryResponse++; |
| if (buildCounterQueryResponse < 3) { |
| o.cacheHit = true; |
| o.jobComplete = true; |
| o.jobReference = buildJobReference(); |
| o.kind = "foo"; |
| o.pageToken = "foo"; |
| o.rows = buildUnnamed1023(); |
| o.schema = buildTableSchema(); |
| o.totalBytesProcessed = "foo"; |
| o.totalRows = "foo"; |
| } |
| buildCounterQueryResponse--; |
| return o; |
| } |
| |
| checkQueryResponse(api.QueryResponse o) { |
| buildCounterQueryResponse++; |
| if (buildCounterQueryResponse < 3) { |
| unittest.expect(o.cacheHit, unittest.isTrue); |
| unittest.expect(o.jobComplete, unittest.isTrue); |
| checkJobReference(o.jobReference); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.pageToken, unittest.equals('foo')); |
| checkUnnamed1023(o.rows); |
| checkTableSchema(o.schema); |
| unittest.expect(o.totalBytesProcessed, unittest.equals('foo')); |
| unittest.expect(o.totalRows, unittest.equals('foo')); |
| } |
| buildCounterQueryResponse--; |
| } |
| |
| core.int buildCounterTable = 0; |
| buildTable() { |
| var o = new api.Table(); |
| buildCounterTable++; |
| if (buildCounterTable < 3) { |
| o.creationTime = "foo"; |
| o.description = "foo"; |
| o.etag = "foo"; |
| o.expirationTime = "foo"; |
| o.friendlyName = "foo"; |
| o.id = "foo"; |
| o.kind = "foo"; |
| o.lastModifiedTime = "foo"; |
| o.numBytes = "foo"; |
| o.numRows = "foo"; |
| o.schema = buildTableSchema(); |
| o.selfLink = "foo"; |
| o.tableReference = buildTableReference(); |
| o.type = "foo"; |
| o.view = buildViewDefinition(); |
| } |
| buildCounterTable--; |
| return o; |
| } |
| |
| checkTable(api.Table o) { |
| buildCounterTable++; |
| if (buildCounterTable < 3) { |
| unittest.expect(o.creationTime, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.expirationTime, unittest.equals('foo')); |
| unittest.expect(o.friendlyName, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.lastModifiedTime, unittest.equals('foo')); |
| unittest.expect(o.numBytes, unittest.equals('foo')); |
| unittest.expect(o.numRows, unittest.equals('foo')); |
| checkTableSchema(o.schema); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| checkTableReference(o.tableReference); |
| unittest.expect(o.type, unittest.equals('foo')); |
| checkViewDefinition(o.view); |
| } |
| buildCounterTable--; |
| } |
| |
| core.int buildCounterTableCell = 0; |
| buildTableCell() { |
| var o = new api.TableCell(); |
| buildCounterTableCell++; |
| if (buildCounterTableCell < 3) { |
| o.v = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| } |
| buildCounterTableCell--; |
| return o; |
| } |
| |
| checkTableCell(api.TableCell o) { |
| buildCounterTableCell++; |
| if (buildCounterTableCell < 3) { |
| var casted3 = (o.v) as core.Map; unittest.expect(casted3, unittest.hasLength(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.expect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], unittest.equals('foo')); |
| } |
| buildCounterTableCell--; |
| } |
| |
| core.int buildCounterTableDataInsertAllRequestRows = 0; |
| buildTableDataInsertAllRequestRows() { |
| var o = new api.TableDataInsertAllRequestRows(); |
| buildCounterTableDataInsertAllRequestRows++; |
| if (buildCounterTableDataInsertAllRequestRows < 3) { |
| o.insertId = "foo"; |
| o.json = buildJsonObject(); |
| } |
| buildCounterTableDataInsertAllRequestRows--; |
| return o; |
| } |
| |
| checkTableDataInsertAllRequestRows(api.TableDataInsertAllRequestRows o) { |
| buildCounterTableDataInsertAllRequestRows++; |
| if (buildCounterTableDataInsertAllRequestRows < 3) { |
| unittest.expect(o.insertId, unittest.equals('foo')); |
| checkJsonObject(o.json); |
| } |
| buildCounterTableDataInsertAllRequestRows--; |
| } |
| |
| buildUnnamed1024() { |
| var o = new core.List<api.TableDataInsertAllRequestRows>(); |
| o.add(buildTableDataInsertAllRequestRows()); |
| o.add(buildTableDataInsertAllRequestRows()); |
| return o; |
| } |
| |
| checkUnnamed1024(core.List<api.TableDataInsertAllRequestRows> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableDataInsertAllRequestRows(o[0]); |
| checkTableDataInsertAllRequestRows(o[1]); |
| } |
| |
| core.int buildCounterTableDataInsertAllRequest = 0; |
| buildTableDataInsertAllRequest() { |
| var o = new api.TableDataInsertAllRequest(); |
| buildCounterTableDataInsertAllRequest++; |
| if (buildCounterTableDataInsertAllRequest < 3) { |
| o.kind = "foo"; |
| o.rows = buildUnnamed1024(); |
| } |
| buildCounterTableDataInsertAllRequest--; |
| return o; |
| } |
| |
| checkTableDataInsertAllRequest(api.TableDataInsertAllRequest o) { |
| buildCounterTableDataInsertAllRequest++; |
| if (buildCounterTableDataInsertAllRequest < 3) { |
| unittest.expect(o.kind, unittest.equals('foo')); |
| checkUnnamed1024(o.rows); |
| } |
| buildCounterTableDataInsertAllRequest--; |
| } |
| |
| buildUnnamed1025() { |
| var o = new core.List<api.ErrorProto>(); |
| o.add(buildErrorProto()); |
| o.add(buildErrorProto()); |
| return o; |
| } |
| |
| checkUnnamed1025(core.List<api.ErrorProto> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkErrorProto(o[0]); |
| checkErrorProto(o[1]); |
| } |
| |
| core.int buildCounterTableDataInsertAllResponseInsertErrors = 0; |
| buildTableDataInsertAllResponseInsertErrors() { |
| var o = new api.TableDataInsertAllResponseInsertErrors(); |
| buildCounterTableDataInsertAllResponseInsertErrors++; |
| if (buildCounterTableDataInsertAllResponseInsertErrors < 3) { |
| o.errors = buildUnnamed1025(); |
| o.index = 42; |
| } |
| buildCounterTableDataInsertAllResponseInsertErrors--; |
| return o; |
| } |
| |
| checkTableDataInsertAllResponseInsertErrors(api.TableDataInsertAllResponseInsertErrors o) { |
| buildCounterTableDataInsertAllResponseInsertErrors++; |
| if (buildCounterTableDataInsertAllResponseInsertErrors < 3) { |
| checkUnnamed1025(o.errors); |
| unittest.expect(o.index, unittest.equals(42)); |
| } |
| buildCounterTableDataInsertAllResponseInsertErrors--; |
| } |
| |
| buildUnnamed1026() { |
| var o = new core.List<api.TableDataInsertAllResponseInsertErrors>(); |
| o.add(buildTableDataInsertAllResponseInsertErrors()); |
| o.add(buildTableDataInsertAllResponseInsertErrors()); |
| return o; |
| } |
| |
| checkUnnamed1026(core.List<api.TableDataInsertAllResponseInsertErrors> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableDataInsertAllResponseInsertErrors(o[0]); |
| checkTableDataInsertAllResponseInsertErrors(o[1]); |
| } |
| |
| core.int buildCounterTableDataInsertAllResponse = 0; |
| buildTableDataInsertAllResponse() { |
| var o = new api.TableDataInsertAllResponse(); |
| buildCounterTableDataInsertAllResponse++; |
| if (buildCounterTableDataInsertAllResponse < 3) { |
| o.insertErrors = buildUnnamed1026(); |
| o.kind = "foo"; |
| } |
| buildCounterTableDataInsertAllResponse--; |
| return o; |
| } |
| |
| checkTableDataInsertAllResponse(api.TableDataInsertAllResponse o) { |
| buildCounterTableDataInsertAllResponse++; |
| if (buildCounterTableDataInsertAllResponse < 3) { |
| checkUnnamed1026(o.insertErrors); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| } |
| buildCounterTableDataInsertAllResponse--; |
| } |
| |
| buildUnnamed1027() { |
| var o = new core.List<api.TableRow>(); |
| o.add(buildTableRow()); |
| o.add(buildTableRow()); |
| return o; |
| } |
| |
| checkUnnamed1027(core.List<api.TableRow> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableRow(o[0]); |
| checkTableRow(o[1]); |
| } |
| |
| core.int buildCounterTableDataList = 0; |
| buildTableDataList() { |
| var o = new api.TableDataList(); |
| buildCounterTableDataList++; |
| if (buildCounterTableDataList < 3) { |
| o.etag = "foo"; |
| o.kind = "foo"; |
| o.pageToken = "foo"; |
| o.rows = buildUnnamed1027(); |
| o.totalRows = "foo"; |
| } |
| buildCounterTableDataList--; |
| return o; |
| } |
| |
| checkTableDataList(api.TableDataList o) { |
| buildCounterTableDataList++; |
| if (buildCounterTableDataList < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.pageToken, unittest.equals('foo')); |
| checkUnnamed1027(o.rows); |
| unittest.expect(o.totalRows, unittest.equals('foo')); |
| } |
| buildCounterTableDataList--; |
| } |
| |
| buildUnnamed1028() { |
| var o = new core.List<api.TableFieldSchema>(); |
| o.add(buildTableFieldSchema()); |
| o.add(buildTableFieldSchema()); |
| return o; |
| } |
| |
| checkUnnamed1028(core.List<api.TableFieldSchema> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableFieldSchema(o[0]); |
| checkTableFieldSchema(o[1]); |
| } |
| |
| core.int buildCounterTableFieldSchema = 0; |
| buildTableFieldSchema() { |
| var o = new api.TableFieldSchema(); |
| buildCounterTableFieldSchema++; |
| if (buildCounterTableFieldSchema < 3) { |
| o.description = "foo"; |
| o.fields = buildUnnamed1028(); |
| o.mode = "foo"; |
| o.name = "foo"; |
| o.type = "foo"; |
| } |
| buildCounterTableFieldSchema--; |
| return o; |
| } |
| |
| checkTableFieldSchema(api.TableFieldSchema o) { |
| buildCounterTableFieldSchema++; |
| if (buildCounterTableFieldSchema < 3) { |
| unittest.expect(o.description, unittest.equals('foo')); |
| checkUnnamed1028(o.fields); |
| unittest.expect(o.mode, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.type, unittest.equals('foo')); |
| } |
| buildCounterTableFieldSchema--; |
| } |
| |
| core.int buildCounterTableListTables = 0; |
| buildTableListTables() { |
| var o = new api.TableListTables(); |
| buildCounterTableListTables++; |
| if (buildCounterTableListTables < 3) { |
| o.friendlyName = "foo"; |
| o.id = "foo"; |
| o.kind = "foo"; |
| o.tableReference = buildTableReference(); |
| o.type = "foo"; |
| } |
| buildCounterTableListTables--; |
| return o; |
| } |
| |
| checkTableListTables(api.TableListTables o) { |
| buildCounterTableListTables++; |
| if (buildCounterTableListTables < 3) { |
| unittest.expect(o.friendlyName, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| checkTableReference(o.tableReference); |
| unittest.expect(o.type, unittest.equals('foo')); |
| } |
| buildCounterTableListTables--; |
| } |
| |
| buildUnnamed1029() { |
| var o = new core.List<api.TableListTables>(); |
| o.add(buildTableListTables()); |
| o.add(buildTableListTables()); |
| return o; |
| } |
| |
| checkUnnamed1029(core.List<api.TableListTables> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableListTables(o[0]); |
| checkTableListTables(o[1]); |
| } |
| |
| core.int buildCounterTableList = 0; |
| buildTableList() { |
| var o = new api.TableList(); |
| buildCounterTableList++; |
| if (buildCounterTableList < 3) { |
| o.etag = "foo"; |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| o.tables = buildUnnamed1029(); |
| o.totalItems = 42; |
| } |
| buildCounterTableList--; |
| return o; |
| } |
| |
| checkTableList(api.TableList o) { |
| buildCounterTableList++; |
| if (buildCounterTableList < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed1029(o.tables); |
| unittest.expect(o.totalItems, unittest.equals(42)); |
| } |
| buildCounterTableList--; |
| } |
| |
| core.int buildCounterTableReference = 0; |
| buildTableReference() { |
| var o = new api.TableReference(); |
| buildCounterTableReference++; |
| if (buildCounterTableReference < 3) { |
| o.datasetId = "foo"; |
| o.projectId = "foo"; |
| o.tableId = "foo"; |
| } |
| buildCounterTableReference--; |
| return o; |
| } |
| |
| checkTableReference(api.TableReference o) { |
| buildCounterTableReference++; |
| if (buildCounterTableReference < 3) { |
| unittest.expect(o.datasetId, unittest.equals('foo')); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| unittest.expect(o.tableId, unittest.equals('foo')); |
| } |
| buildCounterTableReference--; |
| } |
| |
| buildUnnamed1030() { |
| var o = new core.List<api.TableCell>(); |
| o.add(buildTableCell()); |
| o.add(buildTableCell()); |
| return o; |
| } |
| |
| checkUnnamed1030(core.List<api.TableCell> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableCell(o[0]); |
| checkTableCell(o[1]); |
| } |
| |
| core.int buildCounterTableRow = 0; |
| buildTableRow() { |
| var o = new api.TableRow(); |
| buildCounterTableRow++; |
| if (buildCounterTableRow < 3) { |
| o.f = buildUnnamed1030(); |
| } |
| buildCounterTableRow--; |
| return o; |
| } |
| |
| checkTableRow(api.TableRow o) { |
| buildCounterTableRow++; |
| if (buildCounterTableRow < 3) { |
| checkUnnamed1030(o.f); |
| } |
| buildCounterTableRow--; |
| } |
| |
| buildUnnamed1031() { |
| var o = new core.List<api.TableFieldSchema>(); |
| o.add(buildTableFieldSchema()); |
| o.add(buildTableFieldSchema()); |
| return o; |
| } |
| |
| checkUnnamed1031(core.List<api.TableFieldSchema> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTableFieldSchema(o[0]); |
| checkTableFieldSchema(o[1]); |
| } |
| |
| core.int buildCounterTableSchema = 0; |
| buildTableSchema() { |
| var o = new api.TableSchema(); |
| buildCounterTableSchema++; |
| if (buildCounterTableSchema < 3) { |
| o.fields = buildUnnamed1031(); |
| } |
| buildCounterTableSchema--; |
| return o; |
| } |
| |
| checkTableSchema(api.TableSchema o) { |
| buildCounterTableSchema++; |
| if (buildCounterTableSchema < 3) { |
| checkUnnamed1031(o.fields); |
| } |
| buildCounterTableSchema--; |
| } |
| |
| core.int buildCounterViewDefinition = 0; |
| buildViewDefinition() { |
| var o = new api.ViewDefinition(); |
| buildCounterViewDefinition++; |
| if (buildCounterViewDefinition < 3) { |
| o.query = "foo"; |
| } |
| buildCounterViewDefinition--; |
| return o; |
| } |
| |
| checkViewDefinition(api.ViewDefinition o) { |
| buildCounterViewDefinition++; |
| if (buildCounterViewDefinition < 3) { |
| unittest.expect(o.query, unittest.equals('foo')); |
| } |
| buildCounterViewDefinition--; |
| } |
| |
| buildUnnamed1032() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed1032(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| |
| main() { |
| unittest.group("obj-schema-DatasetAccess", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDatasetAccess(); |
| var od = new api.DatasetAccess.fromJson(o.toJson()); |
| checkDatasetAccess(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-Dataset", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDataset(); |
| var od = new api.Dataset.fromJson(o.toJson()); |
| checkDataset(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-DatasetListDatasets", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDatasetListDatasets(); |
| var od = new api.DatasetListDatasets.fromJson(o.toJson()); |
| checkDatasetListDatasets(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-DatasetList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDatasetList(); |
| var od = new api.DatasetList.fromJson(o.toJson()); |
| checkDatasetList(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-DatasetReference", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDatasetReference(); |
| var od = new api.DatasetReference.fromJson(o.toJson()); |
| checkDatasetReference(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-ErrorProto", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildErrorProto(); |
| var od = new api.ErrorProto.fromJson(o.toJson()); |
| checkErrorProto(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-GetQueryResultsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGetQueryResultsResponse(); |
| var od = new api.GetQueryResultsResponse.fromJson(o.toJson()); |
| checkGetQueryResultsResponse(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-Job", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJob(); |
| var od = new api.Job.fromJson(o.toJson()); |
| checkJob(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobConfiguration", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobConfiguration(); |
| var od = new api.JobConfiguration.fromJson(o.toJson()); |
| checkJobConfiguration(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobConfigurationExtract", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobConfigurationExtract(); |
| var od = new api.JobConfigurationExtract.fromJson(o.toJson()); |
| checkJobConfigurationExtract(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobConfigurationLink", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobConfigurationLink(); |
| var od = new api.JobConfigurationLink.fromJson(o.toJson()); |
| checkJobConfigurationLink(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobConfigurationLoad", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobConfigurationLoad(); |
| var od = new api.JobConfigurationLoad.fromJson(o.toJson()); |
| checkJobConfigurationLoad(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobConfigurationQuery", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobConfigurationQuery(); |
| var od = new api.JobConfigurationQuery.fromJson(o.toJson()); |
| checkJobConfigurationQuery(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobConfigurationTableCopy", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobConfigurationTableCopy(); |
| var od = new api.JobConfigurationTableCopy.fromJson(o.toJson()); |
| checkJobConfigurationTableCopy(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobListJobs", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobListJobs(); |
| var od = new api.JobListJobs.fromJson(o.toJson()); |
| checkJobListJobs(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobList(); |
| var od = new api.JobList.fromJson(o.toJson()); |
| checkJobList(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobReference", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobReference(); |
| var od = new api.JobReference.fromJson(o.toJson()); |
| checkJobReference(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobStatistics", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobStatistics(); |
| var od = new api.JobStatistics.fromJson(o.toJson()); |
| checkJobStatistics(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobStatistics2", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobStatistics2(); |
| var od = new api.JobStatistics2.fromJson(o.toJson()); |
| checkJobStatistics2(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobStatistics3", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobStatistics3(); |
| var od = new api.JobStatistics3.fromJson(o.toJson()); |
| checkJobStatistics3(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JobStatus", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobStatus(); |
| var od = new api.JobStatus.fromJson(o.toJson()); |
| checkJobStatus(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-JsonObject", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJsonObject(); |
| var od = new api.JsonObject.fromJson(o.toJson()); |
| checkJsonObject(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-ProjectListProjects", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildProjectListProjects(); |
| var od = new api.ProjectListProjects.fromJson(o.toJson()); |
| checkProjectListProjects(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-ProjectList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildProjectList(); |
| var od = new api.ProjectList.fromJson(o.toJson()); |
| checkProjectList(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-ProjectReference", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildProjectReference(); |
| var od = new api.ProjectReference.fromJson(o.toJson()); |
| checkProjectReference(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-QueryRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildQueryRequest(); |
| var od = new api.QueryRequest.fromJson(o.toJson()); |
| checkQueryRequest(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-QueryResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildQueryResponse(); |
| var od = new api.QueryResponse.fromJson(o.toJson()); |
| checkQueryResponse(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-Table", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTable(); |
| var od = new api.Table.fromJson(o.toJson()); |
| checkTable(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableCell", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableCell(); |
| var od = new api.TableCell.fromJson(o.toJson()); |
| checkTableCell(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableDataInsertAllRequestRows", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableDataInsertAllRequestRows(); |
| var od = new api.TableDataInsertAllRequestRows.fromJson(o.toJson()); |
| checkTableDataInsertAllRequestRows(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableDataInsertAllRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableDataInsertAllRequest(); |
| var od = new api.TableDataInsertAllRequest.fromJson(o.toJson()); |
| checkTableDataInsertAllRequest(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableDataInsertAllResponseInsertErrors", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableDataInsertAllResponseInsertErrors(); |
| var od = new api.TableDataInsertAllResponseInsertErrors.fromJson(o.toJson()); |
| checkTableDataInsertAllResponseInsertErrors(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableDataInsertAllResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableDataInsertAllResponse(); |
| var od = new api.TableDataInsertAllResponse.fromJson(o.toJson()); |
| checkTableDataInsertAllResponse(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableDataList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableDataList(); |
| var od = new api.TableDataList.fromJson(o.toJson()); |
| checkTableDataList(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableFieldSchema", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableFieldSchema(); |
| var od = new api.TableFieldSchema.fromJson(o.toJson()); |
| checkTableFieldSchema(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableListTables", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableListTables(); |
| var od = new api.TableListTables.fromJson(o.toJson()); |
| checkTableListTables(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableList(); |
| var od = new api.TableList.fromJson(o.toJson()); |
| checkTableList(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableReference", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableReference(); |
| var od = new api.TableReference.fromJson(o.toJson()); |
| checkTableReference(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableRow", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableRow(); |
| var od = new api.TableRow.fromJson(o.toJson()); |
| checkTableRow(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-TableSchema", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTableSchema(); |
| var od = new api.TableSchema.fromJson(o.toJson()); |
| checkTableSchema(od); |
| }); |
| }); |
| |
| |
| unittest.group("obj-schema-ViewDefinition", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildViewDefinition(); |
| var od = new api.ViewDefinition.fromJson(o.toJson()); |
| checkViewDefinition(od); |
| }); |
| }); |
| |
| |
| unittest.group("resource-DatasetsResourceApi", () { |
| unittest.test("method--delete", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.DatasetsResourceApi res = new api.BigqueryApi(mock).datasets; |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_deleteContents = true; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["deleteContents"].first, unittest.equals("$arg_deleteContents")); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = ""; |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.delete(arg_projectId, arg_datasetId, deleteContents: arg_deleteContents).then(unittest.expectAsync((_) {})); |
| }); |
| |
| unittest.test("method--get", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.DatasetsResourceApi res = new api.BigqueryApi(mock).datasets; |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildDataset()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.get(arg_projectId, arg_datasetId).then(unittest.expectAsync(((api.Dataset response) { |
| checkDataset(response); |
| }))); |
| }); |
| |
| unittest.test("method--insert", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.DatasetsResourceApi res = new api.BigqueryApi(mock).datasets; |
| var arg_request = buildDataset(); |
| var arg_projectId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Dataset.fromJson(json); |
| checkDataset(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("/datasets")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildDataset()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.insert(arg_request, arg_projectId).then(unittest.expectAsync(((api.Dataset response) { |
| checkDataset(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.DatasetsResourceApi res = new api.BigqueryApi(mock).datasets; |
| var arg_projectId = "foo"; |
| var arg_all = true; |
| var arg_maxResults = 42; |
| var arg_pageToken = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("/datasets")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["all"].first, unittest.equals("$arg_all")); |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.equals(arg_maxResults)); |
| unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildDatasetList()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.list(arg_projectId, all: arg_all, maxResults: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.DatasetList response) { |
| checkDatasetList(response); |
| }))); |
| }); |
| |
| unittest.test("method--patch", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.DatasetsResourceApi res = new api.BigqueryApi(mock).datasets; |
| var arg_request = buildDataset(); |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Dataset.fromJson(json); |
| checkDataset(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildDataset()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.patch(arg_request, arg_projectId, arg_datasetId).then(unittest.expectAsync(((api.Dataset response) { |
| checkDataset(response); |
| }))); |
| }); |
| |
| unittest.test("method--update", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.DatasetsResourceApi res = new api.BigqueryApi(mock).datasets; |
| var arg_request = buildDataset(); |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Dataset.fromJson(json); |
| checkDataset(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildDataset()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.update(arg_request, arg_projectId, arg_datasetId).then(unittest.expectAsync(((api.Dataset response) { |
| checkDataset(response); |
| }))); |
| }); |
| |
| }); |
| |
| |
| unittest.group("resource-JobsResourceApi", () { |
| unittest.test("method--get", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.JobsResourceApi res = new api.BigqueryApi(mock).jobs; |
| var arg_projectId = "foo"; |
| var arg_jobId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equals("/jobs/")); |
| pathOffset += 6; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_jobId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJob()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.get(arg_projectId, arg_jobId).then(unittest.expectAsync(((api.Job response) { |
| checkJob(response); |
| }))); |
| }); |
| |
| unittest.test("method--getQueryResults", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.JobsResourceApi res = new api.BigqueryApi(mock).jobs; |
| var arg_projectId = "foo"; |
| var arg_jobId = "foo"; |
| var arg_maxResults = 42; |
| var arg_pageToken = "foo"; |
| var arg_startIndex = "foo"; |
| var arg_timeoutMs = 42; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/queries/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("/queries/")); |
| pathOffset += 9; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_jobId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.equals(arg_maxResults)); |
| unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(queryMap["startIndex"].first, unittest.equals(arg_startIndex)); |
| unittest.expect(core.int.parse(queryMap["timeoutMs"].first), unittest.equals(arg_timeoutMs)); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildGetQueryResultsResponse()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.getQueryResults(arg_projectId, arg_jobId, maxResults: arg_maxResults, pageToken: arg_pageToken, startIndex: arg_startIndex, timeoutMs: arg_timeoutMs).then(unittest.expectAsync(((api.GetQueryResultsResponse response) { |
| checkGetQueryResultsResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--insert", () { |
| // TODO: Implement tests for media upload; |
| // TODO: Implement tests for media download; |
| |
| var mock = new common_test.HttpServerMock(); |
| api.JobsResourceApi res = new api.BigqueryApi(mock).jobs; |
| var arg_request = buildJob(); |
| var arg_projectId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Job.fromJson(json); |
| checkJob(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equals("/jobs")); |
| pathOffset += 5; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJob()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.insert(arg_request, arg_projectId).then(unittest.expectAsync(((api.Job response) { |
| checkJob(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.JobsResourceApi res = new api.BigqueryApi(mock).jobs; |
| var arg_projectId = "foo"; |
| var arg_allUsers = true; |
| var arg_maxResults = 42; |
| var arg_pageToken = "foo"; |
| var arg_projection = "foo"; |
| var arg_stateFilter = buildUnnamed1032(); |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equals("/jobs")); |
| pathOffset += 5; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["allUsers"].first, unittest.equals("$arg_allUsers")); |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.equals(arg_maxResults)); |
| unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(queryMap["projection"].first, unittest.equals(arg_projection)); |
| unittest.expect(queryMap["stateFilter"], unittest.equals(arg_stateFilter)); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJobList()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.list(arg_projectId, allUsers: arg_allUsers, maxResults: arg_maxResults, pageToken: arg_pageToken, projection: arg_projection, stateFilter: arg_stateFilter).then(unittest.expectAsync(((api.JobList response) { |
| checkJobList(response); |
| }))); |
| }); |
| |
| unittest.test("method--query", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.JobsResourceApi res = new api.BigqueryApi(mock).jobs; |
| var arg_request = buildQueryRequest(); |
| var arg_projectId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.QueryRequest.fromJson(json); |
| checkQueryRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/queries", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/queries")); |
| pathOffset += 8; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildQueryResponse()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.query(arg_request, arg_projectId).then(unittest.expectAsync(((api.QueryResponse response) { |
| checkQueryResponse(response); |
| }))); |
| }); |
| |
| }); |
| |
| |
| unittest.group("resource-ProjectsResourceApi", () { |
| unittest.test("method--list", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.ProjectsResourceApi res = new api.BigqueryApi(mock).projects; |
| var arg_maxResults = 42; |
| var arg_pageToken = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("projects")); |
| pathOffset += 8; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.equals(arg_maxResults)); |
| unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildProjectList()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.list(maxResults: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ProjectList response) { |
| checkProjectList(response); |
| }))); |
| }); |
| |
| }); |
| |
| |
| unittest.group("resource-TabledataResourceApi", () { |
| unittest.test("method--insertAll", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TabledataResourceApi res = new api.BigqueryApi(mock).tabledata; |
| var arg_request = buildTableDataInsertAllRequest(); |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_tableId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.TableDataInsertAllRequest.fromJson(json); |
| checkTableDataInsertAllRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/tables/")); |
| pathOffset += 8; |
| index = path.indexOf("/insertAll", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_tableId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/insertAll")); |
| pathOffset += 10; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTableDataInsertAllResponse()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.insertAll(arg_request, arg_projectId, arg_datasetId, arg_tableId).then(unittest.expectAsync(((api.TableDataInsertAllResponse response) { |
| checkTableDataInsertAllResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TabledataResourceApi res = new api.BigqueryApi(mock).tabledata; |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_tableId = "foo"; |
| var arg_maxResults = 42; |
| var arg_pageToken = "foo"; |
| var arg_startIndex = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/tables/")); |
| pathOffset += 8; |
| index = path.indexOf("/data", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_tableId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equals("/data")); |
| pathOffset += 5; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.equals(arg_maxResults)); |
| unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(queryMap["startIndex"].first, unittest.equals(arg_startIndex)); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTableDataList()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.list(arg_projectId, arg_datasetId, arg_tableId, maxResults: arg_maxResults, pageToken: arg_pageToken, startIndex: arg_startIndex).then(unittest.expectAsync(((api.TableDataList response) { |
| checkTableDataList(response); |
| }))); |
| }); |
| |
| }); |
| |
| |
| unittest.group("resource-TablesResourceApi", () { |
| unittest.test("method--delete", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TablesResourceApi res = new api.BigqueryApi(mock).tables; |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_tableId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/tables/")); |
| pathOffset += 8; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_tableId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = ""; |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.delete(arg_projectId, arg_datasetId, arg_tableId).then(unittest.expectAsync((_) {})); |
| }); |
| |
| unittest.test("method--get", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TablesResourceApi res = new api.BigqueryApi(mock).tables; |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_tableId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/tables/")); |
| pathOffset += 8; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_tableId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTable()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.get(arg_projectId, arg_datasetId, arg_tableId).then(unittest.expectAsync(((api.Table response) { |
| checkTable(response); |
| }))); |
| }); |
| |
| unittest.test("method--insert", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TablesResourceApi res = new api.BigqueryApi(mock).tables; |
| var arg_request = buildTable(); |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Table.fromJson(json); |
| checkTable(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equals("/tables")); |
| pathOffset += 7; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTable()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.insert(arg_request, arg_projectId, arg_datasetId).then(unittest.expectAsync(((api.Table response) { |
| checkTable(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TablesResourceApi res = new api.BigqueryApi(mock).tables; |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_maxResults = 42; |
| var arg_pageToken = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equals("/tables")); |
| pathOffset += 7; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.equals(arg_maxResults)); |
| unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTableList()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.list(arg_projectId, arg_datasetId, maxResults: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.TableList response) { |
| checkTableList(response); |
| }))); |
| }); |
| |
| unittest.test("method--patch", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TablesResourceApi res = new api.BigqueryApi(mock).tables; |
| var arg_request = buildTable(); |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_tableId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Table.fromJson(json); |
| checkTable(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/tables/")); |
| pathOffset += 8; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_tableId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTable()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.patch(arg_request, arg_projectId, arg_datasetId, arg_tableId).then(unittest.expectAsync(((api.Table response) { |
| checkTable(response); |
| }))); |
| }); |
| |
| unittest.test("method--update", () { |
| |
| var mock = new common_test.HttpServerMock(); |
| api.TablesResourceApi res = new api.BigqueryApi(mock).tables; |
| var arg_request = buildTable(); |
| var arg_projectId = "foo"; |
| var arg_datasetId = "foo"; |
| var arg_tableId = "foo"; |
| mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| var obj = new api.Table.fromJson(json); |
| checkTable(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals("/bigquery/v2/")); |
| pathOffset += 13; |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("projects/")); |
| pathOffset += 9; |
| index = path.indexOf("/datasets/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("/datasets/")); |
| pathOffset += 10; |
| index = path.indexOf("/tables/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_datasetId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("/tables/")); |
| pathOffset += 8; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_tableId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| |
| |
| var h = { |
| "content-type" : "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTable()); |
| return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| }), true); |
| res.update(arg_request, arg_projectId, arg_datasetId, arg_tableId).then(unittest.expectAsync(((api.Table response) { |
| checkTable(response); |
| }))); |
| }); |
| |
| }); |
| |
| |
| } |
| |