|
14 | 14 |
|
15 | 15 | 'use strict'; |
16 | 16 |
|
17 | | -const {assert} = require('chai'); |
18 | | -const {v4: uuidv4} = require('uuid'); |
19 | | -const {ModelArmorClient} = require('@google-cloud/modelarmor').v1; |
20 | | -const {DlpServiceClient} = require('@google-cloud/dlp'); |
| 17 | +const { assert } = require('chai'); |
| 18 | +const { v4: uuidv4 } = require('uuid'); |
| 19 | +const { ModelArmorClient } = require('@google-cloud/modelarmor').v1; |
| 20 | +const { DlpServiceClient } = require('@google-cloud/dlp'); |
21 | 21 |
|
22 | 22 | let projectId; |
23 | 23 | const locationId = process.env.GCLOUD_LOCATION || 'us-central1'; |
@@ -173,9 +173,9 @@ async function createDlpTemplates() { |
173 | 173 | inspectTemplate: { |
174 | 174 | inspectConfig: { |
175 | 175 | infoTypes: [ |
176 | | - {name: 'EMAIL_ADDRESS'}, |
177 | | - {name: 'PHONE_NUMBER'}, |
178 | | - {name: 'US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER'}, |
| 176 | + { name: 'EMAIL_ADDRESS' }, |
| 177 | + { name: 'PHONE_NUMBER' }, |
| 178 | + { name: 'US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER' }, |
179 | 179 | ], |
180 | 180 | }, |
181 | 181 | }, |
@@ -260,7 +260,7 @@ describe('Model Armor tests', () => { |
260 | 260 |
|
261 | 261 | before(async () => { |
262 | 262 | projectId = await client.getProjectId(); |
263 | | - const {protos} = require('@google-cloud/modelarmor'); |
| 263 | + const { protos } = require('@google-cloud/modelarmor'); |
264 | 264 | // Import necessary enums |
265 | 265 | const DetectionConfidenceLevel = |
266 | 266 | protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel; |
@@ -298,9 +298,9 @@ describe('Model Armor tests', () => { |
298 | 298 | basicConfig: { |
299 | 299 | filterEnforcement: SdpBasicConfigEnforcement.ENABLED, |
300 | 300 | infoTypes: [ |
301 | | - {name: 'EMAIL_ADDRESS'}, |
302 | | - {name: 'PHONE_NUMBER'}, |
303 | | - {name: 'US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER'}, |
| 301 | + { name: 'EMAIL_ADDRESS' }, |
| 302 | + { name: 'PHONE_NUMBER' }, |
| 303 | + { name: 'US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER' }, |
304 | 304 | ], |
305 | 305 | }, |
306 | 306 | }, |
@@ -381,66 +381,6 @@ describe('Model Armor tests', () => { |
381 | 381 | await deleteDlpTemplates(); |
382 | 382 | }); |
383 | 383 |
|
384 | | - // =================== Floor Settings Tests =================== |
385 | | - |
386 | | - // TODO(b/424365799): Enable below tests once the mentioned issue is resolved |
387 | | - |
388 | | - it.skip('should get organization floor settings', () => { |
389 | | - const getOrganizationFloorSettings = require('../snippets/getOrganizationFloorSettings'); |
390 | | - |
391 | | - const output = getOrganizationFloorSettings(organizationId).toString(); |
392 | | - |
393 | | - const expectedName = `organizations/${organizationId}/locations/global/floorSetting`; |
394 | | - assert.match(output, new RegExp(expectedName.replace(/\//g, '\\/'))); |
395 | | - }); |
396 | | - |
397 | | - it.skip('should get folder floor settings', () => { |
398 | | - const getFolderFloorSettings = require('../snippets/getFolderFloorSettings'); |
399 | | - |
400 | | - const output = getFolderFloorSettings(folderId).toString(); |
401 | | - |
402 | | - // Check for expected name format in output |
403 | | - const expectedName = `folders/${folderId}/locations/global/floorSetting`; |
404 | | - assert.match(output, new RegExp(expectedName.replace(/\//g, '\\/'))); |
405 | | - }); |
406 | | - |
407 | | - it.skip('should get project floor settings', () => { |
408 | | - const getProjectFloorSettings = require('../snippets/getProjectFloorSettings'); |
409 | | - |
410 | | - const output = getProjectFloorSettings(projectId).toString(); |
411 | | - |
412 | | - // Check for expected name format in output |
413 | | - const expectedName = `projects/${projectId}/locations/global/floorSetting`; |
414 | | - assert.match(output, new RegExp(expectedName.replace(/\//g, '\\/'))); |
415 | | - }); |
416 | | - |
417 | | - it.skip('should update organization floor settings', () => { |
418 | | - const updateOrganizationFloorSettings = require('../snippets/updateOrganizationFloorSettings'); |
419 | | - const output = updateOrganizationFloorSettings(organizationId).toString(); |
420 | | - // Check that the update was performed |
421 | | - assert.match(output, /Updated organization floor settings/); |
422 | | - // Check that the response contains enableFloorSettingEnforcement=true |
423 | | - assert.match(output, /enableFloorSettingEnforcement:\s*true/); |
424 | | - }); |
425 | | - |
426 | | - it.skip('should update folder floor settings', () => { |
427 | | - const updateFolderFloorSettings = require('../snippets/updateFolderFloorSettings'); |
428 | | - const output = updateFolderFloorSettings(folderId).toString(); |
429 | | - // Check that the update was performed |
430 | | - assert.match(output, /Updated folder floor settings/); |
431 | | - // Check that the response contains enableFloorSettingEnforcement=true |
432 | | - assert.match(output, /enableFloorSettingEnforcement:\s*true/); |
433 | | - }); |
434 | | - |
435 | | - it.skip('should update project floor settings', () => { |
436 | | - const updateProjectFloorSettings = require('../snippets/updateProjectFloorSettings'); |
437 | | - const output = updateProjectFloorSettings(projectId).toString(); |
438 | | - // Check that the update was performed |
439 | | - assert.match(output, /Updated project floor settings/); |
440 | | - // Check that the response contains enableFloorSettingEnforcement=true |
441 | | - assert.match(output, /enableFloorSettingEnforcement:\s*true/); |
442 | | - }); |
443 | | - |
444 | 384 | // =================== Template Creation Tests =================== |
445 | 385 |
|
446 | 386 | it('should create a basic template', async () => { |
@@ -997,4 +937,57 @@ describe('Model Armor tests', () => { |
997 | 937 | 'NO_MATCH_FOUND' |
998 | 938 | ); |
999 | 939 | }); |
| 940 | + |
| 941 | + // =================== Floor Settings Tests =================== |
| 942 | + |
| 943 | + // TODO(b/424365799): Enable below tests once the mentioned issue is resolved |
| 944 | + |
| 945 | + it.skip('should get organization floor settings', async () => { |
| 946 | + const getOrganizationFloorSettings = require('../snippets/getOrganizationFloorSettings'); |
| 947 | + |
| 948 | + const output = await getOrganizationFloorSettings.main(organizationId); |
| 949 | + |
| 950 | + const expectedName = `organizations/${organizationId}/locations/global/floorSetting`; |
| 951 | + assert.equal(output.name, expectedName); |
| 952 | + }); |
| 953 | + |
| 954 | + it.skip('should get folder floor settings', async () => { |
| 955 | + const getFolderFloorSettings = require('../snippets/getFolderFloorSettings'); |
| 956 | + |
| 957 | + const output = await getFolderFloorSettings.main(folderId); |
| 958 | + |
| 959 | + // Check for expected name format in output |
| 960 | + const expectedName = `folders/${folderId}/locations/global/floorSetting`; |
| 961 | + assert.equal(output.name, expectedName); |
| 962 | + }); |
| 963 | + |
| 964 | + it.skip('should get project floor settings', async () => { |
| 965 | + const getProjectFloorSettings = require('../snippets/getProjectFloorSettings'); |
| 966 | + |
| 967 | + const output = await getProjectFloorSettings.main(projectId) |
| 968 | + // Check for expected name format in output |
| 969 | + const expectedName = `projects/${projectId}/locations/global/floorSetting`; |
| 970 | + assert.equal(output.name, expectedName); |
| 971 | + }); |
| 972 | + |
| 973 | + it.skip('should update organization floor settings', async () => { |
| 974 | + const updateOrganizationFloorSettings = require('../snippets/updateOrganizationFloorSettings'); |
| 975 | + const output = await updateOrganizationFloorSettings.main(organizationId); |
| 976 | + // Check that the enableFloorSettingEnforcement=true |
| 977 | + assert.equal(output.enableFloorSettingEnforcement, true); |
| 978 | + }); |
| 979 | + |
| 980 | + it.skip('should update folder floor settings', async () => { |
| 981 | + const updateFolderFloorSettings = require('../snippets/updateFolderFloorSettings'); |
| 982 | + const output = await updateFolderFloorSettings.main(folderId); |
| 983 | + // Check that the enableFloorSettingEnforcement=true |
| 984 | + assert.equal(output.enableFloorSettingEnforcement, true); |
| 985 | + }); |
| 986 | + |
| 987 | + it.skip('should update project floor settings', async () => { |
| 988 | + const updateProjectFloorSettings = require('../snippets/updateProjectFloorSettings'); |
| 989 | + const output = await updateProjectFloorSettings.main(projectId); |
| 990 | + // Check that the enableFloorSettingEnforcement=true |
| 991 | + assert.equal(output.enableFloorSettingEnforcement, true); |
| 992 | + }); |
1000 | 993 | }); |
0 commit comments