mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
[PM-26671] Google workspace integration tests (#894)
Add tests for Google Workspace - not enabled in CI yet
This commit is contained in:
56
utils/google-workspace/config-fixtures.ts
Normal file
56
utils/google-workspace/config-fixtures.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { GSuiteConfiguration } from "../../src/models/gsuiteConfiguration";
|
||||
import { SyncConfiguration } from "../../src/models/syncConfiguration";
|
||||
|
||||
/**
|
||||
* @returns a basic GSuite configuration. Can be overridden by passing in a partial configuration.
|
||||
*/
|
||||
export const getGSuiteConfiguration = (
|
||||
config?: Partial<GSuiteConfiguration>,
|
||||
): GSuiteConfiguration => {
|
||||
const adminUser = process.env.GOOGLE_ADMIN_USER;
|
||||
const clientEmail = process.env.GOOGLE_CLIENT_EMAIL;
|
||||
const privateKey = process.env.GOOGLE_PRIVATE_KEY;
|
||||
const domain = process.env.GOOGLE_DOMAIN;
|
||||
|
||||
if (!adminUser || !clientEmail || !privateKey || !domain) {
|
||||
throw new Error("Google Workspace integration test credentials not configured.");
|
||||
}
|
||||
|
||||
return {
|
||||
// TODO
|
||||
adminUser,
|
||||
clientEmail,
|
||||
privateKey,
|
||||
domain: domain,
|
||||
customer: "",
|
||||
...(config ?? {}),
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns a basic Google Workspace sync configuration. Can be overridden by passing in a partial configuration.
|
||||
*/
|
||||
export const getSyncConfiguration = (config?: Partial<SyncConfiguration>): SyncConfiguration => ({
|
||||
users: false,
|
||||
groups: false,
|
||||
interval: 5,
|
||||
userFilter: "",
|
||||
groupFilter: "",
|
||||
removeDisabled: false,
|
||||
overwriteExisting: false,
|
||||
largeImport: false,
|
||||
// Ldap properties - not optional for some reason
|
||||
groupObjectClass: "",
|
||||
userObjectClass: "",
|
||||
groupPath: null,
|
||||
userPath: null,
|
||||
groupNameAttribute: "",
|
||||
userEmailAttribute: "",
|
||||
memberAttribute: "",
|
||||
useEmailPrefixSuffix: false,
|
||||
emailPrefixAttribute: "",
|
||||
emailSuffix: null,
|
||||
creationDateAttribute: "",
|
||||
revisionDateAttribute: "",
|
||||
...(config ?? {}),
|
||||
});
|
||||
Reference in New Issue
Block a user