Skip to content

Commit

Permalink
chore: new owl bot post processor docker image (#290)
Browse files Browse the repository at this point in the history
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
  • Loading branch information
gcf-owl-bot[bot] authored May 10, 2021
1 parent 02b95de commit 098e382
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 91 deletions.
10 changes: 5 additions & 5 deletions packages/google-cloud-phishingprotection/protos/protos.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions packages/google-cloud-phishingprotection/protos/protos.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/google-cloud-phishingprotection/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import * as v1beta1 from './v1beta1';

const PhishingProtectionServiceV1Beta1Client =
v1beta1.PhishingProtectionServiceV1Beta1Client;
type PhishingProtectionServiceV1Beta1Client = v1beta1.PhishingProtectionServiceV1Beta1Client;
type PhishingProtectionServiceV1Beta1Client =
v1beta1.PhishingProtectionServiceV1Beta1Client;

export {v1beta1, PhishingProtectionServiceV1Beta1Client};
export default {v1beta1, PhishingProtectionServiceV1Beta1Client};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,14 @@ export class PhishingProtectionServiceV1Beta1Client {
const phishingProtectionServiceV1Beta1StubMethods = ['reportPhishing'];
for (const methodName of phishingProtectionServiceV1Beta1StubMethods) {
const callPromise = this.phishingProtectionServiceV1Beta1Stub.then(
stub => (...args: Array<{}>) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
const func = stub[methodName];
return func.apply(stub, args);
},
stub =>
(...args: Array<{}>) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
const func = stub[methodName];
return func.apply(stub, args);
},
(err: Error | null | undefined) => () => {
throw err;
}
Expand Down Expand Up @@ -389,11 +390,10 @@ export class PhishingProtectionServiceV1Beta1Client {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
parent: request.parent || '',
});
this.initialize();
return this.innerApiCalls.reportPhishing(request, options, callback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
const phishingprotection = require('@google-cloud/phishing-protection');

function main() {
const phishingProtectionServiceV1Beta1Client = new phishingprotection.PhishingProtectionServiceV1Beta1Client();
const phishingProtectionServiceV1Beta1Client =
new phishingprotection.PhishingProtectionServiceV1Beta1Client();
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function doStuffWithPhishingProtectionServiceV1Beta1Client(

function main() {
// check that the client instance can be created
const phishingProtectionServiceV1Beta1Client = new PhishingProtectionServiceV1Beta1Client();
const phishingProtectionServiceV1Beta1Client =
new PhishingProtectionServiceV1Beta1Client();
doStuffWithPhishingProtectionServiceV1Beta1Client(
phishingProtectionServiceV1Beta1Client
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ import * as phishingprotectionservicev1beta1Module from '../src';
import {protobuf} from 'google-gax';

function generateSampleMessage<T extends object>(instance: T) {
const filledObject = (instance.constructor as typeof protobuf.Message).toObject(
instance as protobuf.Message<T>,
{defaults: true}
);
const filledObject = (
instance.constructor as typeof protobuf.Message
).toObject(instance as protobuf.Message<T>, {defaults: true});
return (instance.constructor as typeof protobuf.Message).fromObject(
filledObject
) as T;
Expand Down Expand Up @@ -74,49 +73,54 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
});

it('should create a client with no option', () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client();
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client();
assert(client);
});

it('should create a client with gRPC fallback', () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
fallback: true,
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
fallback: true,
}
);
assert(client);
});

it('has initialize method and supports deferred initialization', async () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
assert.strictEqual(client.phishingProtectionServiceV1Beta1Stub, undefined);
await client.initialize();
assert(client.phishingProtectionServiceV1Beta1Stub);
});

it('has close method', () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.close();
});

it('has getProjectId method', async () => {
const fakeProjectId = 'fake-project-id';
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.auth.getProjectId = sinon.stub().resolves(fakeProjectId);
const result = await client.getProjectId();
assert.strictEqual(result, fakeProjectId);
Expand All @@ -125,12 +129,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {

it('has getProjectId method with callback', async () => {
const fakeProjectId = 'fake-project-id';
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.auth.getProjectId = sinon
.stub()
.callsArgWith(0, null, fakeProjectId);
Expand All @@ -149,12 +154,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {

describe('reportPhishing', () => {
it('invokes reportPhishing without error', async () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.initialize();
const request = generateSampleMessage(
new protos.google.cloud.phishingprotection.v1beta1.ReportPhishingRequest()
Expand Down Expand Up @@ -182,12 +188,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
});

it('invokes reportPhishing without error using callback', async () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.initialize();
const request = generateSampleMessage(
new protos.google.cloud.phishingprotection.v1beta1.ReportPhishingRequest()
Expand All @@ -204,9 +211,8 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
const expectedResponse = generateSampleMessage(
new protos.google.cloud.phishingprotection.v1beta1.ReportPhishingResponse()
);
client.innerApiCalls.reportPhishing = stubSimpleCallWithCallback(
expectedResponse
);
client.innerApiCalls.reportPhishing =
stubSimpleCallWithCallback(expectedResponse);
const promise = new Promise((resolve, reject) => {
client.reportPhishing(
request,
Expand All @@ -232,12 +238,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
});

it('invokes reportPhishing with error', async () => {
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.initialize();
const request = generateSampleMessage(
new protos.google.cloud.phishingprotection.v1beta1.ReportPhishingRequest()
Expand Down Expand Up @@ -271,12 +278,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
const expectedParameters = {
project: 'projectValue',
};
const client = new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
const client =
new phishingprotectionservicev1beta1Module.v1beta1.PhishingProtectionServiceV1Beta1Client(
{
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
}
);
client.initialize();
client.pathTemplates.projectPathTemplate.render = sinon
.stub()
Expand Down

0 comments on commit 098e382

Please sign in to comment.