Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ describe('GmailConnector', () => {
});
});

describe('auth', () => {
it('supports bearer auth', () => {
expect(GmailConnector.auth?.types).toContain('bearer');
});

it('supports oauth_authorization_code with correct Google defaults', () => {
const oauthType = GmailConnector.auth?.types.find(
(t) => typeof t === 'object' && t.type === 'oauth_authorization_code'
);
expect(oauthType).toBeDefined();
expect(oauthType).toMatchObject({
type: 'oauth_authorization_code',
defaults: {
authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
scope: 'https://www.googleapis.com/auth/gmail.readonly',
},
});
});
});

describe('actions', () => {
it('exposes searchMessages, getMessage, getAttachment, listMessages actions', () => {
expect(GmailConnector.actions.searchMessages).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ export const GmailConnector: ConnectorSpec = {
supportedFeatureIds: ['workflows', 'agentBuilder'],
},
auth: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add EARS now? Or can we have a way to add it based on a FF?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet until #253695 is merged. Then, when we start enabling it, it will have to be behind a feature flag.

types: ['bearer'],
types: [
'bearer',
{
type: 'oauth_authorization_code',
defaults: {
authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
scope: 'https://www.googleapis.com/auth/gmail.readonly',
},
},
],
headers: {
Accept: 'application/json',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,25 @@ describe('GoogleCalendar', () => {
expect(GoogleCalendar.metadata.supportedFeatureIds).toContain('workflows');
});

it('should use bearer auth', () => {
it('should support bearer auth', () => {
expect(GoogleCalendar.auth?.types).toContain('bearer');
});

it('should support oauth_authorization_code with correct Google defaults', () => {
const oauthType = GoogleCalendar.auth?.types.find(
(t) => typeof t === 'object' && t.type === 'oauth_authorization_code'
);
expect(oauthType).toBeDefined();
expect(oauthType).toMatchObject({
type: 'oauth_authorization_code',
defaults: {
authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
scope: 'https://www.googleapis.com/auth/calendar.readonly',
},
});
});

it('should define all five actions as tools', () => {
expect(GoogleCalendar.actions.searchEvents.isTool).toBe(true);
expect(GoogleCalendar.actions.getEvent.isTool).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,17 @@ export const GoogleCalendar: ConnectorSpec = {
supportedFeatureIds: ['workflows', 'agentBuilder'],
},
auth: {
types: ['bearer'],
types: [
'bearer',
{
type: 'oauth_authorization_code',
defaults: {
authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
scope: 'https://www.googleapis.com/auth/calendar.readonly',
},
},
],
headers: {
Accept: 'application/json',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ describe('GoogleDriveConnector', () => {
jest.clearAllMocks();
});

describe('auth', () => {
it('supports bearer auth', () => {
expect(GoogleDriveConnector.auth?.types).toContain('bearer');
});

it('supports oauth_authorization_code with correct Google defaults', () => {
const oauthType = GoogleDriveConnector.auth?.types.find(
(t) => typeof t === 'object' && t.type === 'oauth_authorization_code'
);
expect(oauthType).toBeDefined();
expect(oauthType).toMatchObject({
type: 'oauth_authorization_code',
defaults: {
authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
scope:
'https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/drive.metadata.readonly',
},
});
});
});

describe('searchFiles action', () => {
it('should search files with a query', async () => {
const mockResponse = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ export const GoogleDriveConnector: ConnectorSpec = {
supportedFeatureIds: ['workflows', 'agentBuilder'],
},
auth: {
types: ['bearer'],
types: [
'bearer',
{
type: 'oauth_authorization_code',
defaults: {
authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
scope:
'https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/drive.metadata.readonly',
},
},
],
headers: {
Accept: 'application/json',
},
Expand Down
Loading