Skip to content

Commit

Permalink
Fix Threat Detection tests for release .SDK v5 (#1)
Browse files Browse the repository at this point in the history
* FIX TESTS WITH SDK VERSION 5

* small fixes

* records of threat detection tests
  • Loading branch information
ayeletshpigelman authored and viparek committed May 7, 2021
1 parent e0353eb commit d653a7d
Show file tree
Hide file tree
Showing 12 changed files with 3,899 additions and 2,889 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public async void TestCreateUpdateGetDatabaseVulnerabilityAssessments()
// Turn ON database threat detection as a prerequisite to use VA
DatabaseSecurityAlertPolicy updatedDatabasePolicy = new DatabaseSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
EmailAccountAdmins = SecurityAlertPolicyEmailAccountAdmins.Enabled
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};
sqlClient.DatabaseThreatDetectionPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);
sqlClient.DatabaseSecurityAlertPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);

// Verify Policy is empty to begin with
DatabaseVulnerabilityAssessment policyThatWasReceived = sqlClient.DatabaseVulnerabilityAssessments.Get(resourceGroup.Name, server.Name, dbName);
Expand Down Expand Up @@ -98,10 +98,10 @@ public async void TestCreateUpdateGetDeleteDatabaseVulnerabilityAssessmentBaseli
// Turn ON database threat detection as a prerequisite to use VA
DatabaseSecurityAlertPolicy updatedDatabasePolicy = new DatabaseSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
EmailAccountAdmins = SecurityAlertPolicyEmailAccountAdmins.Enabled
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};
sqlClient.DatabaseThreatDetectionPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);
sqlClient.DatabaseSecurityAlertPolicies .CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);

// Set policy
await SetPolicy(context, sqlClient, resourceGroup, server, dbName);
Expand Down Expand Up @@ -140,10 +140,10 @@ public async void TestExecuteGetListDatabaseVulnerabilityAssessmentScans()
// Turn ON database threat detection as a prerequisite to use VA
DatabaseSecurityAlertPolicy updatedDatabasePolicy = new DatabaseSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
EmailAccountAdmins = SecurityAlertPolicyEmailAccountAdmins.Enabled
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};
sqlClient.DatabaseThreatDetectionPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);
sqlClient.DatabaseSecurityAlertPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);

// Set policy
await SetPolicy(context, sqlClient, resourceGroup, server, dbName);
Expand Down Expand Up @@ -200,10 +200,10 @@ public async void TestExportDatabaseVulnerabilityAssessmentScans()
// Turn ON database threat detection as a prerequisite to use VA
DatabaseSecurityAlertPolicy updatedDatabasePolicy = new DatabaseSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
EmailAccountAdmins = SecurityAlertPolicyEmailAccountAdmins.Enabled
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};
sqlClient.DatabaseThreatDetectionPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);
sqlClient.DatabaseSecurityAlertPolicies.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, updatedDatabasePolicy);

// Set policy
await SetPolicy(context, sqlClient, resourceGroup, server, dbName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private async Task<DatabaseVulnerabilityAssessment> SetPolicy(SqlManagementTestC
// Modify the policy properties, send and receive and see it its still ok
ManagedServerSecurityAlertPolicy updatedManagedServerPolicy = new ManagedServerSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void TestManagedInstanceThreatDetection()
// Modify the policy properties, send and receive and see it its still ok
ManagedServerSecurityAlertPolicy updatedManagedServerPolicy = new ManagedServerSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};

Expand All @@ -69,7 +69,7 @@ public void TestManagedInstanceThreatDetection()
// Modify the policy properties again, send and receive and see it its still ok
updatedManagedServerPolicy = new ManagedServerSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Disabled,
State = SecurityAlertsPolicyState.Disabled,
EmailAccountAdmins = true,
EmailAddresses = new List<string>() { "testSecurityAlert@microsoft.com", "testServerPolicy@microsoft.com" },
DisabledAlerts = new List<string>() { "Sql_Injection" },
Expand Down Expand Up @@ -139,7 +139,7 @@ private ManagedServerSecurityAlertPolicy GetDefaultManagedInstanceSecurityAlertP
{
ManagedServerSecurityAlertPolicy properties = new ManagedServerSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Disabled,
State = SecurityAlertsPolicyState.Disabled,
EmailAccountAdmins = false,
DisabledAlerts = new List<string>() { string.Empty },
EmailAddresses = new List<string>() { string.Empty },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private async Task<ManagedInstanceVulnerabilityAssessment> SetPolicy(SqlManageme
// Modify the policy properties, send and receive and see it its still ok
ManagedServerSecurityAlertPolicy updatedManagedServerPolicy = new ManagedServerSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async void TestCreateUpdateGetServerVulnerabilityAssessments()
// Turn ON Server ATP(threat detection) as a prerequisite to use VA
ServerSecurityAlertPolicy updatedServerPolicy = new ServerSecurityAlertPolicy
{
State = SecurityAlertPolicyState.Enabled,
State = SecurityAlertsPolicyState.Enabled,
EmailAccountAdmins = true
};

Expand Down
Loading

0 comments on commit d653a7d

Please sign in to comment.