blob: f91184b9bfd31b57ad953c0eaedc97ae7f9fdcb3 [file] [log] [blame]
library googleapis.binaryauthorization.v1.test;
import "dart:core" as core;
import "dart:async" as async;
import "dart:convert" as convert;
import 'package:http/http.dart' as http;
import 'package:test/test.dart' as unittest;
import 'package:googleapis/binaryauthorization/v1.dart' as api;
class HttpServerMock extends http.BaseClient {
core.Function _callback;
core.bool _expectJson;
void register(core.Function callback, core.bool expectJson) {
_callback = callback;
_expectJson = expectJson;
}
async.Future<http.StreamedResponse> send(http.BaseRequest request) {
if (_expectJson) {
return request
.finalize()
.transform(convert.utf8.decoder)
.join('')
.then((core.String jsonString) {
if (jsonString.isEmpty) {
return _callback(request, null);
} else {
return _callback(request, convert.json.decode(jsonString));
}
});
} else {
var stream = request.finalize();
if (stream == null) {
return _callback(request, []);
} else {
return stream.toBytes().then((data) {
return _callback(request, data);
});
}
}
}
}
http.StreamedResponse stringResponse(core.int status,
core.Map<core.String, core.String> headers, core.String body) {
var stream = new async.Stream.fromIterable([convert.utf8.encode(body)]);
return new http.StreamedResponse(stream, status, headers: headers);
}
buildUnnamed2379() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed2379(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 buildCounterAdmissionRule = 0;
buildAdmissionRule() {
var o = new api.AdmissionRule();
buildCounterAdmissionRule++;
if (buildCounterAdmissionRule < 3) {
o.enforcementMode = "foo";
o.evaluationMode = "foo";
o.requireAttestationsBy = buildUnnamed2379();
}
buildCounterAdmissionRule--;
return o;
}
checkAdmissionRule(api.AdmissionRule o) {
buildCounterAdmissionRule++;
if (buildCounterAdmissionRule < 3) {
unittest.expect(o.enforcementMode, unittest.equals('foo'));
unittest.expect(o.evaluationMode, unittest.equals('foo'));
checkUnnamed2379(o.requireAttestationsBy);
}
buildCounterAdmissionRule--;
}
core.int buildCounterAdmissionWhitelistPattern = 0;
buildAdmissionWhitelistPattern() {
var o = new api.AdmissionWhitelistPattern();
buildCounterAdmissionWhitelistPattern++;
if (buildCounterAdmissionWhitelistPattern < 3) {
o.namePattern = "foo";
}
buildCounterAdmissionWhitelistPattern--;
return o;
}
checkAdmissionWhitelistPattern(api.AdmissionWhitelistPattern o) {
buildCounterAdmissionWhitelistPattern++;
if (buildCounterAdmissionWhitelistPattern < 3) {
unittest.expect(o.namePattern, unittest.equals('foo'));
}
buildCounterAdmissionWhitelistPattern--;
}
buildUnnamed2380() {
var o = new core.List<api.Jwt>();
o.add(buildJwt());
o.add(buildJwt());
return o;
}
checkUnnamed2380(core.List<api.Jwt> o) {
unittest.expect(o, unittest.hasLength(2));
checkJwt(o[0]);
checkJwt(o[1]);
}
buildUnnamed2381() {
var o = new core.List<api.Signature>();
o.add(buildSignature());
o.add(buildSignature());
return o;
}
checkUnnamed2381(core.List<api.Signature> o) {
unittest.expect(o, unittest.hasLength(2));
checkSignature(o[0]);
checkSignature(o[1]);
}
core.int buildCounterAttestationOccurrence = 0;
buildAttestationOccurrence() {
var o = new api.AttestationOccurrence();
buildCounterAttestationOccurrence++;
if (buildCounterAttestationOccurrence < 3) {
o.jwts = buildUnnamed2380();
o.serializedPayload = "foo";
o.signatures = buildUnnamed2381();
}
buildCounterAttestationOccurrence--;
return o;
}
checkAttestationOccurrence(api.AttestationOccurrence o) {
buildCounterAttestationOccurrence++;
if (buildCounterAttestationOccurrence < 3) {
checkUnnamed2380(o.jwts);
unittest.expect(o.serializedPayload, unittest.equals('foo'));
checkUnnamed2381(o.signatures);
}
buildCounterAttestationOccurrence--;
}
core.int buildCounterAttestor = 0;
buildAttestor() {
var o = new api.Attestor();
buildCounterAttestor++;
if (buildCounterAttestor < 3) {
o.description = "foo";
o.name = "foo";
o.updateTime = "foo";
o.userOwnedGrafeasNote = buildUserOwnedGrafeasNote();
}
buildCounterAttestor--;
return o;
}
checkAttestor(api.Attestor o) {
buildCounterAttestor++;
if (buildCounterAttestor < 3) {
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.updateTime, unittest.equals('foo'));
checkUserOwnedGrafeasNote(o.userOwnedGrafeasNote);
}
buildCounterAttestor--;
}
core.int buildCounterAttestorPublicKey = 0;
buildAttestorPublicKey() {
var o = new api.AttestorPublicKey();
buildCounterAttestorPublicKey++;
if (buildCounterAttestorPublicKey < 3) {
o.asciiArmoredPgpPublicKey = "foo";
o.comment = "foo";
o.id = "foo";
o.pkixPublicKey = buildPkixPublicKey();
}
buildCounterAttestorPublicKey--;
return o;
}
checkAttestorPublicKey(api.AttestorPublicKey o) {
buildCounterAttestorPublicKey++;
if (buildCounterAttestorPublicKey < 3) {
unittest.expect(o.asciiArmoredPgpPublicKey, unittest.equals('foo'));
unittest.expect(o.comment, unittest.equals('foo'));
unittest.expect(o.id, unittest.equals('foo'));
checkPkixPublicKey(o.pkixPublicKey);
}
buildCounterAttestorPublicKey--;
}
buildUnnamed2382() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed2382(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 buildCounterBinding = 0;
buildBinding() {
var o = new api.Binding();
buildCounterBinding++;
if (buildCounterBinding < 3) {
o.bindingId = "foo";
o.condition = buildExpr();
o.members = buildUnnamed2382();
o.role = "foo";
}
buildCounterBinding--;
return o;
}
checkBinding(api.Binding o) {
buildCounterBinding++;
if (buildCounterBinding < 3) {
unittest.expect(o.bindingId, unittest.equals('foo'));
checkExpr(o.condition);
checkUnnamed2382(o.members);
unittest.expect(o.role, unittest.equals('foo'));
}
buildCounterBinding--;
}
core.int buildCounterEmpty = 0;
buildEmpty() {
var o = new api.Empty();
buildCounterEmpty++;
if (buildCounterEmpty < 3) {}
buildCounterEmpty--;
return o;
}
checkEmpty(api.Empty o) {
buildCounterEmpty++;
if (buildCounterEmpty < 3) {}
buildCounterEmpty--;
}
core.int buildCounterExpr = 0;
buildExpr() {
var o = new api.Expr();
buildCounterExpr++;
if (buildCounterExpr < 3) {
o.description = "foo";
o.expression = "foo";
o.location = "foo";
o.title = "foo";
}
buildCounterExpr--;
return o;
}
checkExpr(api.Expr o) {
buildCounterExpr++;
if (buildCounterExpr < 3) {
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.expression, unittest.equals('foo'));
unittest.expect(o.location, unittest.equals('foo'));
unittest.expect(o.title, unittest.equals('foo'));
}
buildCounterExpr--;
}
buildUnnamed2383() {
var o = new core.List<api.Binding>();
o.add(buildBinding());
o.add(buildBinding());
return o;
}
checkUnnamed2383(core.List<api.Binding> o) {
unittest.expect(o, unittest.hasLength(2));
checkBinding(o[0]);
checkBinding(o[1]);
}
core.int buildCounterIamPolicy = 0;
buildIamPolicy() {
var o = new api.IamPolicy();
buildCounterIamPolicy++;
if (buildCounterIamPolicy < 3) {
o.bindings = buildUnnamed2383();
o.etag = "foo";
o.version = 42;
}
buildCounterIamPolicy--;
return o;
}
checkIamPolicy(api.IamPolicy o) {
buildCounterIamPolicy++;
if (buildCounterIamPolicy < 3) {
checkUnnamed2383(o.bindings);
unittest.expect(o.etag, unittest.equals('foo'));
unittest.expect(o.version, unittest.equals(42));
}
buildCounterIamPolicy--;
}
core.int buildCounterJwt = 0;
buildJwt() {
var o = new api.Jwt();
buildCounterJwt++;
if (buildCounterJwt < 3) {
o.compactJwt = "foo";
}
buildCounterJwt--;
return o;
}
checkJwt(api.Jwt o) {
buildCounterJwt++;
if (buildCounterJwt < 3) {
unittest.expect(o.compactJwt, unittest.equals('foo'));
}
buildCounterJwt--;
}
buildUnnamed2384() {
var o = new core.List<api.Attestor>();
o.add(buildAttestor());
o.add(buildAttestor());
return o;
}
checkUnnamed2384(core.List<api.Attestor> o) {
unittest.expect(o, unittest.hasLength(2));
checkAttestor(o[0]);
checkAttestor(o[1]);
}
core.int buildCounterListAttestorsResponse = 0;
buildListAttestorsResponse() {
var o = new api.ListAttestorsResponse();
buildCounterListAttestorsResponse++;
if (buildCounterListAttestorsResponse < 3) {
o.attestors = buildUnnamed2384();
o.nextPageToken = "foo";
}
buildCounterListAttestorsResponse--;
return o;
}
checkListAttestorsResponse(api.ListAttestorsResponse o) {
buildCounterListAttestorsResponse++;
if (buildCounterListAttestorsResponse < 3) {
checkUnnamed2384(o.attestors);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListAttestorsResponse--;
}
core.int buildCounterPkixPublicKey = 0;
buildPkixPublicKey() {
var o = new api.PkixPublicKey();
buildCounterPkixPublicKey++;
if (buildCounterPkixPublicKey < 3) {
o.publicKeyPem = "foo";
o.signatureAlgorithm = "foo";
}
buildCounterPkixPublicKey--;
return o;
}
checkPkixPublicKey(api.PkixPublicKey o) {
buildCounterPkixPublicKey++;
if (buildCounterPkixPublicKey < 3) {
unittest.expect(o.publicKeyPem, unittest.equals('foo'));
unittest.expect(o.signatureAlgorithm, unittest.equals('foo'));
}
buildCounterPkixPublicKey--;
}
buildUnnamed2385() {
var o = new core.List<api.AdmissionWhitelistPattern>();
o.add(buildAdmissionWhitelistPattern());
o.add(buildAdmissionWhitelistPattern());
return o;
}
checkUnnamed2385(core.List<api.AdmissionWhitelistPattern> o) {
unittest.expect(o, unittest.hasLength(2));
checkAdmissionWhitelistPattern(o[0]);
checkAdmissionWhitelistPattern(o[1]);
}
buildUnnamed2386() {
var o = new core.Map<core.String, api.AdmissionRule>();
o["x"] = buildAdmissionRule();
o["y"] = buildAdmissionRule();
return o;
}
checkUnnamed2386(core.Map<core.String, api.AdmissionRule> o) {
unittest.expect(o, unittest.hasLength(2));
checkAdmissionRule(o["x"]);
checkAdmissionRule(o["y"]);
}
core.int buildCounterPolicy = 0;
buildPolicy() {
var o = new api.Policy();
buildCounterPolicy++;
if (buildCounterPolicy < 3) {
o.admissionWhitelistPatterns = buildUnnamed2385();
o.clusterAdmissionRules = buildUnnamed2386();
o.defaultAdmissionRule = buildAdmissionRule();
o.description = "foo";
o.globalPolicyEvaluationMode = "foo";
o.name = "foo";
o.updateTime = "foo";
}
buildCounterPolicy--;
return o;
}
checkPolicy(api.Policy o) {
buildCounterPolicy++;
if (buildCounterPolicy < 3) {
checkUnnamed2385(o.admissionWhitelistPatterns);
checkUnnamed2386(o.clusterAdmissionRules);
checkAdmissionRule(o.defaultAdmissionRule);
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.globalPolicyEvaluationMode, unittest.equals('foo'));
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.updateTime, unittest.equals('foo'));
}
buildCounterPolicy--;
}
core.int buildCounterSetIamPolicyRequest = 0;
buildSetIamPolicyRequest() {
var o = new api.SetIamPolicyRequest();
buildCounterSetIamPolicyRequest++;
if (buildCounterSetIamPolicyRequest < 3) {
o.policy = buildIamPolicy();
}
buildCounterSetIamPolicyRequest--;
return o;
}
checkSetIamPolicyRequest(api.SetIamPolicyRequest o) {
buildCounterSetIamPolicyRequest++;
if (buildCounterSetIamPolicyRequest < 3) {
checkIamPolicy(o.policy);
}
buildCounterSetIamPolicyRequest--;
}
core.int buildCounterSignature = 0;
buildSignature() {
var o = new api.Signature();
buildCounterSignature++;
if (buildCounterSignature < 3) {
o.publicKeyId = "foo";
o.signature = "foo";
}
buildCounterSignature--;
return o;
}
checkSignature(api.Signature o) {
buildCounterSignature++;
if (buildCounterSignature < 3) {
unittest.expect(o.publicKeyId, unittest.equals('foo'));
unittest.expect(o.signature, unittest.equals('foo'));
}
buildCounterSignature--;
}
buildUnnamed2387() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed2387(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 buildCounterTestIamPermissionsRequest = 0;
buildTestIamPermissionsRequest() {
var o = new api.TestIamPermissionsRequest();
buildCounterTestIamPermissionsRequest++;
if (buildCounterTestIamPermissionsRequest < 3) {
o.permissions = buildUnnamed2387();
}
buildCounterTestIamPermissionsRequest--;
return o;
}
checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) {
buildCounterTestIamPermissionsRequest++;
if (buildCounterTestIamPermissionsRequest < 3) {
checkUnnamed2387(o.permissions);
}
buildCounterTestIamPermissionsRequest--;
}
buildUnnamed2388() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed2388(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 buildCounterTestIamPermissionsResponse = 0;
buildTestIamPermissionsResponse() {
var o = new api.TestIamPermissionsResponse();
buildCounterTestIamPermissionsResponse++;
if (buildCounterTestIamPermissionsResponse < 3) {
o.permissions = buildUnnamed2388();
}
buildCounterTestIamPermissionsResponse--;
return o;
}
checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) {
buildCounterTestIamPermissionsResponse++;
if (buildCounterTestIamPermissionsResponse < 3) {
checkUnnamed2388(o.permissions);
}
buildCounterTestIamPermissionsResponse--;
}
buildUnnamed2389() {
var o = new core.List<api.AttestorPublicKey>();
o.add(buildAttestorPublicKey());
o.add(buildAttestorPublicKey());
return o;
}
checkUnnamed2389(core.List<api.AttestorPublicKey> o) {
unittest.expect(o, unittest.hasLength(2));
checkAttestorPublicKey(o[0]);
checkAttestorPublicKey(o[1]);
}
core.int buildCounterUserOwnedGrafeasNote = 0;
buildUserOwnedGrafeasNote() {
var o = new api.UserOwnedGrafeasNote();
buildCounterUserOwnedGrafeasNote++;
if (buildCounterUserOwnedGrafeasNote < 3) {
o.delegationServiceAccountEmail = "foo";
o.noteReference = "foo";
o.publicKeys = buildUnnamed2389();
}
buildCounterUserOwnedGrafeasNote--;
return o;
}
checkUserOwnedGrafeasNote(api.UserOwnedGrafeasNote o) {
buildCounterUserOwnedGrafeasNote++;
if (buildCounterUserOwnedGrafeasNote < 3) {
unittest.expect(o.delegationServiceAccountEmail, unittest.equals('foo'));
unittest.expect(o.noteReference, unittest.equals('foo'));
checkUnnamed2389(o.publicKeys);
}
buildCounterUserOwnedGrafeasNote--;
}
core.int buildCounterValidateAttestationOccurrenceRequest = 0;
buildValidateAttestationOccurrenceRequest() {
var o = new api.ValidateAttestationOccurrenceRequest();
buildCounterValidateAttestationOccurrenceRequest++;
if (buildCounterValidateAttestationOccurrenceRequest < 3) {
o.attestation = buildAttestationOccurrence();
o.occurrenceNote = "foo";
o.occurrenceResourceUri = "foo";
}
buildCounterValidateAttestationOccurrenceRequest--;
return o;
}
checkValidateAttestationOccurrenceRequest(
api.ValidateAttestationOccurrenceRequest o) {
buildCounterValidateAttestationOccurrenceRequest++;
if (buildCounterValidateAttestationOccurrenceRequest < 3) {
checkAttestationOccurrence(o.attestation);
unittest.expect(o.occurrenceNote, unittest.equals('foo'));
unittest.expect(o.occurrenceResourceUri, unittest.equals('foo'));
}
buildCounterValidateAttestationOccurrenceRequest--;
}
core.int buildCounterValidateAttestationOccurrenceResponse = 0;
buildValidateAttestationOccurrenceResponse() {
var o = new api.ValidateAttestationOccurrenceResponse();
buildCounterValidateAttestationOccurrenceResponse++;
if (buildCounterValidateAttestationOccurrenceResponse < 3) {
o.denialReason = "foo";
o.result = "foo";
}
buildCounterValidateAttestationOccurrenceResponse--;
return o;
}
checkValidateAttestationOccurrenceResponse(
api.ValidateAttestationOccurrenceResponse o) {
buildCounterValidateAttestationOccurrenceResponse++;
if (buildCounterValidateAttestationOccurrenceResponse < 3) {
unittest.expect(o.denialReason, unittest.equals('foo'));
unittest.expect(o.result, unittest.equals('foo'));
}
buildCounterValidateAttestationOccurrenceResponse--;
}
main() {
unittest.group("obj-schema-AdmissionRule", () {
unittest.test("to-json--from-json", () {
var o = buildAdmissionRule();
var od = new api.AdmissionRule.fromJson(o.toJson());
checkAdmissionRule(od);
});
});
unittest.group("obj-schema-AdmissionWhitelistPattern", () {
unittest.test("to-json--from-json", () {
var o = buildAdmissionWhitelistPattern();
var od = new api.AdmissionWhitelistPattern.fromJson(o.toJson());
checkAdmissionWhitelistPattern(od);
});
});
unittest.group("obj-schema-AttestationOccurrence", () {
unittest.test("to-json--from-json", () {
var o = buildAttestationOccurrence();
var od = new api.AttestationOccurrence.fromJson(o.toJson());
checkAttestationOccurrence(od);
});
});
unittest.group("obj-schema-Attestor", () {
unittest.test("to-json--from-json", () {
var o = buildAttestor();
var od = new api.Attestor.fromJson(o.toJson());
checkAttestor(od);
});
});
unittest.group("obj-schema-AttestorPublicKey", () {
unittest.test("to-json--from-json", () {
var o = buildAttestorPublicKey();
var od = new api.AttestorPublicKey.fromJson(o.toJson());
checkAttestorPublicKey(od);
});
});
unittest.group("obj-schema-Binding", () {
unittest.test("to-json--from-json", () {
var o = buildBinding();
var od = new api.Binding.fromJson(o.toJson());
checkBinding(od);
});
});
unittest.group("obj-schema-Empty", () {
unittest.test("to-json--from-json", () {
var o = buildEmpty();
var od = new api.Empty.fromJson(o.toJson());
checkEmpty(od);
});
});
unittest.group("obj-schema-Expr", () {
unittest.test("to-json--from-json", () {
var o = buildExpr();
var od = new api.Expr.fromJson(o.toJson());
checkExpr(od);
});
});
unittest.group("obj-schema-IamPolicy", () {
unittest.test("to-json--from-json", () {
var o = buildIamPolicy();
var od = new api.IamPolicy.fromJson(o.toJson());
checkIamPolicy(od);
});
});
unittest.group("obj-schema-Jwt", () {
unittest.test("to-json--from-json", () {
var o = buildJwt();
var od = new api.Jwt.fromJson(o.toJson());
checkJwt(od);
});
});
unittest.group("obj-schema-ListAttestorsResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListAttestorsResponse();
var od = new api.ListAttestorsResponse.fromJson(o.toJson());
checkListAttestorsResponse(od);
});
});
unittest.group("obj-schema-PkixPublicKey", () {
unittest.test("to-json--from-json", () {
var o = buildPkixPublicKey();
var od = new api.PkixPublicKey.fromJson(o.toJson());
checkPkixPublicKey(od);
});
});
unittest.group("obj-schema-Policy", () {
unittest.test("to-json--from-json", () {
var o = buildPolicy();
var od = new api.Policy.fromJson(o.toJson());
checkPolicy(od);
});
});
unittest.group("obj-schema-SetIamPolicyRequest", () {
unittest.test("to-json--from-json", () {
var o = buildSetIamPolicyRequest();
var od = new api.SetIamPolicyRequest.fromJson(o.toJson());
checkSetIamPolicyRequest(od);
});
});
unittest.group("obj-schema-Signature", () {
unittest.test("to-json--from-json", () {
var o = buildSignature();
var od = new api.Signature.fromJson(o.toJson());
checkSignature(od);
});
});
unittest.group("obj-schema-TestIamPermissionsRequest", () {
unittest.test("to-json--from-json", () {
var o = buildTestIamPermissionsRequest();
var od = new api.TestIamPermissionsRequest.fromJson(o.toJson());
checkTestIamPermissionsRequest(od);
});
});
unittest.group("obj-schema-TestIamPermissionsResponse", () {
unittest.test("to-json--from-json", () {
var o = buildTestIamPermissionsResponse();
var od = new api.TestIamPermissionsResponse.fromJson(o.toJson());
checkTestIamPermissionsResponse(od);
});
});
unittest.group("obj-schema-UserOwnedGrafeasNote", () {
unittest.test("to-json--from-json", () {
var o = buildUserOwnedGrafeasNote();
var od = new api.UserOwnedGrafeasNote.fromJson(o.toJson());
checkUserOwnedGrafeasNote(od);
});
});
unittest.group("obj-schema-ValidateAttestationOccurrenceRequest", () {
unittest.test("to-json--from-json", () {
var o = buildValidateAttestationOccurrenceRequest();
var od =
new api.ValidateAttestationOccurrenceRequest.fromJson(o.toJson());
checkValidateAttestationOccurrenceRequest(od);
});
});
unittest.group("obj-schema-ValidateAttestationOccurrenceResponse", () {
unittest.test("to-json--from-json", () {
var o = buildValidateAttestationOccurrenceResponse();
var od =
new api.ValidateAttestationOccurrenceResponse.fromJson(o.toJson());
checkValidateAttestationOccurrenceResponse(od);
});
});
unittest.group("resource-ProjectsResourceApi", () {
unittest.test("method--getPolicy", () {
var mock = new HttpServerMock();
api.ProjectsResourceApi res =
new api.BinaryauthorizationApi(mock).projects;
var arg_name = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildPolicy());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getPolicy(arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkPolicy(response);
})));
});
unittest.test("method--updatePolicy", () {
var mock = new HttpServerMock();
api.ProjectsResourceApi res =
new api.BinaryauthorizationApi(mock).projects;
var arg_request = buildPolicy();
var arg_name = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.Policy.fromJson(json);
checkPolicy(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildPolicy());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updatePolicy(arg_request, arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkPolicy(response);
})));
});
});
unittest.group("resource-ProjectsAttestorsResourceApi", () {
unittest.test("method--create", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_request = buildAttestor();
var arg_parent = "foo";
var arg_attestorId = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.Attestor.fromJson(json);
checkAttestor(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["attestorId"].first, unittest.equals(arg_attestorId));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildAttestor());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_parent,
attestorId: arg_attestorId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkAttestor(response);
})));
});
unittest.test("method--delete", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_name = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildEmpty());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkEmpty(response);
})));
});
unittest.test("method--get", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_name = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildAttestor());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkAttestor(response);
})));
});
unittest.test("method--getIamPolicy", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_resource = "foo";
var arg_options_requestedPolicyVersion = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["options.requestedPolicyVersion"].first),
unittest.equals(arg_options_requestedPolicyVersion));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildIamPolicy());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getIamPolicy(arg_resource,
options_requestedPolicyVersion:
arg_options_requestedPolicyVersion,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkIamPolicy(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_parent = "foo";
var arg_pageSize = 42;
var arg_pageToken = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildListAttestorsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_parent,
pageSize: arg_pageSize,
pageToken: arg_pageToken,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListAttestorsResponse(response);
})));
});
unittest.test("method--setIamPolicy", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_request = buildSetIamPolicyRequest();
var arg_resource = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.SetIamPolicyRequest.fromJson(json);
checkSetIamPolicyRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildIamPolicy());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.setIamPolicy(arg_request, arg_resource, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkIamPolicy(response);
})));
});
unittest.test("method--testIamPermissions", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_request = buildTestIamPermissionsRequest();
var arg_resource = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.TestIamPermissionsRequest.fromJson(json);
checkTestIamPermissionsRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildTestIamPermissionsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.testIamPermissions(arg_request, arg_resource, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkTestIamPermissionsResponse(response);
})));
});
unittest.test("method--update", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_request = buildAttestor();
var arg_name = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.Attestor.fromJson(json);
checkAttestor(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildAttestor());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.update(arg_request, arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkAttestor(response);
})));
});
unittest.test("method--validateAttestationOccurrence", () {
var mock = new HttpServerMock();
api.ProjectsAttestorsResourceApi res =
new api.BinaryauthorizationApi(mock).projects.attestors;
var arg_request = buildValidateAttestationOccurrenceRequest();
var arg_attestor = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.ValidateAttestationOccurrenceRequest.fromJson(json);
checkValidateAttestationOccurrenceRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp =
convert.json.encode(buildValidateAttestationOccurrenceResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.validateAttestationOccurrence(arg_request, arg_attestor,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkValidateAttestationOccurrenceResponse(response);
})));
});
});
unittest.group("resource-ProjectsPolicyResourceApi", () {
unittest.test("method--getIamPolicy", () {
var mock = new HttpServerMock();
api.ProjectsPolicyResourceApi res =
new api.BinaryauthorizationApi(mock).projects.policy;
var arg_resource = "foo";
var arg_options_requestedPolicyVersion = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["options.requestedPolicyVersion"].first),
unittest.equals(arg_options_requestedPolicyVersion));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildIamPolicy());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getIamPolicy(arg_resource,
options_requestedPolicyVersion:
arg_options_requestedPolicyVersion,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkIamPolicy(response);
})));
});
unittest.test("method--setIamPolicy", () {
var mock = new HttpServerMock();
api.ProjectsPolicyResourceApi res =
new api.BinaryauthorizationApi(mock).projects.policy;
var arg_request = buildSetIamPolicyRequest();
var arg_resource = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.SetIamPolicyRequest.fromJson(json);
checkSetIamPolicyRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildIamPolicy());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.setIamPolicy(arg_request, arg_resource, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkIamPolicy(response);
})));
});
unittest.test("method--testIamPermissions", () {
var mock = new HttpServerMock();
api.ProjectsPolicyResourceApi res =
new api.BinaryauthorizationApi(mock).projects.policy;
var arg_request = buildTestIamPermissionsRequest();
var arg_resource = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.TestIamPermissionsRequest.fromJson(json);
checkTestIamPermissionsRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
var index;
var subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
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["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.json.encode(buildTestIamPermissionsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.testIamPermissions(arg_request, arg_resource, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkTestIamPermissionsResponse(response);
})));
});
});
}