use of com.google.cloud.websecurityscanner.v1beta.WebSecurityScannerSettings in project java-websecurityscanner by googleapis.
the class VPCServiceControlNegativeTest method testScanConfigList.
@Test
public void testScanConfigList() throws IOException {
// try to get the list of scan configs - it must fail
WebSecurityScannerSettings wssSetting = getWssSettingWithCredentials();
final String formattedParent = ProjectName.format(OUT_VPCSC_PROJECT);
try (WebSecurityScannerClient wssClient = WebSecurityScannerClient.create(wssSetting)) {
ListScanConfigsRequest lscRequest = ListScanConfigsRequest.newBuilder().setParent(formattedParent).build();
ListScanConfigsPagedResponse scanConfigsList = wssClient.listScanConfigs(lscRequest);
fail("Exception must occur for non-acceessible project scan-configs");
} catch (PermissionDeniedException expected) {
}
}
use of com.google.cloud.websecurityscanner.v1beta.WebSecurityScannerSettings in project java-websecurityscanner by googleapis.
the class VPCServiceControlNegativeTest method testScanConfigCreation.
@Test
public void testScanConfigCreation() throws IOException {
WebSecurityScannerSettings wssSetting = getWssSettingWithCredentials();
final String formattedParent = ProjectName.format(OUT_VPCSC_PROJECT);
try (WebSecurityScannerClient wssClient = WebSecurityScannerClient.create(wssSetting)) {
ScanConfig scanConfig = ScanConfig.newBuilder().addAllStartingUrls(Lists.newArrayList(OUT_VPCSC_HOSTNAME)).setDisplayName(testScanConfigCreationDisplayName).build();
CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder().setParent(formattedParent).setScanConfig(scanConfig).build();
ScanConfig responseScanConfig = wssClient.createScanConfig(request);
fail("Exception must occur for non-accessible project");
} catch (PermissionDeniedException expected) {
}
}
Aggregations