Skip to content

Commit

Permalink
Merge pull request #20 from MabOneSdk/anudeeb
Browse files Browse the repository at this point in the history
Protection policy tests
  • Loading branch information
Samuel Anudeep committed Jun 12, 2015
2 parents 5e63990 + a6bb846 commit 3a36f4e
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/repositories.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<repository path="..\src\RedisCacheManagement\packages.config" />
<repository path="..\src\RemoteApp\packages.config" />
<repository path="..\src\Resource\ResourceManagement\packages.config" />
<repository path="..\src\ResourceManagement\Network\NetworkManagement\packages.config" />
<repository path="..\src\ResourceManagement\Resource\ResourceManagement\packages.config" />
<repository path="..\src\ResourceManagement\Sql\SqlManagement\packages.config" />
<repository path="..\src\SchedulerManagement\packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
<None Include="SessionRecords\BackupServices.Tests.EnableAzureBackupProtectionTest\EnableAzureBackupProtection.json" />
<None Include="SessionRecords\BackupServices.Tests.GetAzureBackupItemPOTest\ListAzureBackupItemPOTest.json" />
<None Include="SessionRecords\BackupServices.Tests.GetAzureBackupItemsDSTest\ListAzureBackupItemDSTest.json" />
<None Include="SessionRecords\BackupServices.Tests.ProtectionPolicyTests\AddProtectionPolicyTest.json" />
<None Include="SessionRecords\BackupServices.Tests.ProtectionPolicyTests\DeleteProtectionPolicyTest.json" />
<None Include="SessionRecords\BackupServices.Tests.ProtectionPolicyTests\ListProtectionPolicyTest.json" />
<None Include="SessionRecords\BackupServices.Tests.ProtectionPolicyTests\UpdateProtectionPolicyTest.json" />
<None Include="SessionRecords\BackupServices.Tests.RecoveryPointTests\ListRecoveryPointTest.json" />
<None Include="SessionRecords\BackupServices.Tests.VaultTests\UploadCertReturnsValidResponseTest.json" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void AddProtectionPolicyTest()

var response = client.ProtectionPolicy.Add(addProtectionPolicyRequest, GetCustomRequestHeaders());

Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}

Expand All @@ -75,7 +75,7 @@ public void UpdateProtectionPolicyTest()
string policyId = ConfigurationManager.AppSettings["PolicyId"];
updateProtectionPolicyRequest.Schedule = backupSchedule; var response = client.ProtectionPolicy.Update(policyId, updateProtectionPolicyRequest, GetCustomRequestHeaders());

Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/protectionpolicies?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vcHJvdGVjdGlvbnBvbGljaWVzP2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"workloadtype\": \"VM\",\r\n \"policyname\": \"ProtPolicy01\",\r\n \"schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": [],\r\n \"ScheduleRunTimes\": [\r\n \"2015-06-12T19:30:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": \"Days\",\r\n \"RetentionDuration\": 30\r\n }\r\n }\r\n}",
"RequestHeaders": {
"Content-Type": [
"application/json"
],
"Content-Length": [
"377"
],
"Accept-Language": [
"en-us"
],
"x-ms-client-request-id": [
"f0253337-7620-40bc-80a5-9f728411cdf5"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "\"00000000-0000-0000-0000-000000000000\"",
"ResponseHeaders": {
"Content-Length": [
"38"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"c9dd20a2-3ff0-4cfc-a520-1d3eee2ed99e"
],
"x-ms-client-request-id": [
"f0253337-7620-40bc-80a5-9f728411cdf5",
"f0253337-7620-40bc-80a5-9f728411cdf5"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1199"
],
"x-ms-correlation-request-id": [
"c9dd20a2-3ff0-4cfc-a520-1d3eee2ed99e"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150612T211619Z:c9dd20a2-3ff0-4cfc-a520-1d3eee2ed99e"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 12 Jun 2015 21:16:18 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/protectionpolicies/3b270816-9802-4384-8657-4f6a91981b89?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vcHJvdGVjdGlvbnBvbGljaWVzLzNiMjcwODE2LTk4MDItNDM4NC04NjU3LTRmNmE5MTk4MWI4OT9hcGktdmVyc2lvbj0yMDE0LTA5LTAx",
"RequestMethod": "DELETE",
"RequestBody": "",
"RequestHeaders": {
"Accept-Language": [
"en-us"
],
"x-ms-client-request-id": [
"5dd9758b-a2e5-4fb0-b7a0-e54b9d2e5b48"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "",
"ResponseHeaders": {
"Content-Length": [
"0"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"a1c7e576-955b-47c8-a5bf-58a2485b1ea5"
],
"x-ms-client-request-id": [
"5dd9758b-a2e5-4fb0-b7a0-e54b9d2e5b48",
"5dd9758b-a2e5-4fb0-b7a0-e54b9d2e5b48"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1197"
],
"x-ms-correlation-request-id": [
"a1c7e576-955b-47c8-a5bf-58a2485b1ea5"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150612T211939Z:a1c7e576-955b-47c8-a5bf-58a2485b1ea5"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 12 Jun 2015 21:19:39 GMT"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 204
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/swatirg1/providers/Microsoft.Backupseadev01/BackupVault/swatirn1/protectionpolicies?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL3N3YXRpcmcxL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvc3dhdGlybjEvcHJvdGVjdGlvbnBvbGljaWVzP2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=",
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/protectionpolicies?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vcHJvdGVjdGlvbnBvbGljaWVzP2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"Accept-Language": [
"en-us"
],
"x-ms-client-request-id": [
"bbc4b0e0-17e2-4ea5-8fea-79b3af14d7d1"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"WorkloadType\": \"VM\",\r\n \"Schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": null,\r\n \"ScheduleRunTimes\": [\r\n \"2015-06-08T20:30:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": 1,\r\n \"RetentionDuration\": 30\r\n }\r\n },\r\n \"InstanceId\": \"40716838-2fa2-453b-8901-3f16ecb5359b\",\r\n \"Name\": \"DefaultPolicy\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"WorkloadType\": \"VM\",\r\n \"Schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": null,\r\n \"ScheduleRunTimes\": [\r\n \"2001-01-01T09:00:00\",\r\n \"2001-01-01T21:00:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": 1,\r\n \"RetentionDuration\": 30\r\n }\r\n },\r\n \"InstanceId\": \"a4ae9969-2de5-40aa-97ce-19889b979d09\",\r\n \"Name\": \"TestPolicyName\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"WorkloadType\": \"VM\",\r\n \"Schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": null,\r\n \"ScheduleRunTimes\": [\r\n \"2001-01-01T09:00:00\",\r\n \"2001-01-01T21:00:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": 1,\r\n \"RetentionDuration\": 30\r\n }\r\n },\r\n \"InstanceId\": \"c5fe92c5-b779-4a2f-bd6e-bc4121ccf599\",\r\n \"Name\": \"TestPolicyName2\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 3,\r\n \"Skiptoken\": null\r\n}",
"ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"WorkloadType\": \"VM\",\r\n \"Schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": null,\r\n \"ScheduleRunTimes\": [\r\n \"2015-06-12T19:30:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": 1,\r\n \"RetentionDuration\": 30\r\n }\r\n },\r\n \"InstanceId\": \"14883de5-6aef-4024-a153-c72e457f8195\",\r\n \"Name\": \"ProtPolicy01\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"WorkloadType\": \"VM\",\r\n \"Schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": null,\r\n \"ScheduleRunTimes\": [\r\n \"2015-06-13T06:30:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": 1,\r\n \"RetentionDuration\": 30\r\n }\r\n },\r\n \"InstanceId\": \"40716838-2fa2-453b-8901-3f16ecb5359b\",\r\n \"Name\": \"DefaultPolicy\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"WorkloadType\": \"VM\",\r\n \"Schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": null,\r\n \"ScheduleRunTimes\": [\r\n \"2015-06-11T14:39:04.6630584Z\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": 1,\r\n \"RetentionDuration\": 2\r\n }\r\n },\r\n \"InstanceId\": \"c87bbada-6e1b-4db2-b76c-9062d28959a4\",\r\n \"Name\": \"Policy9\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 3,\r\n \"Skiptoken\": null\r\n}",
"ResponseHeaders": {
"Content-Length": [
"1140"
"1094"
],
"Content-Type": [
"application/json"
Expand All @@ -28,11 +31,11 @@
"no-cache"
],
"x-ms-request-id": [
"62507eef-c3eb-4d0d-933d-d5ae500ea54a"
"af505e24-a7f1-4594-a508-49d9fd15324c"
],
"x-ms-client-request-id": [
"b5aa9c48-e3ce-44f5-8a8b-e6f9ea410f95",
"b5aa9c48-e3ce-44f5-8a8b-e6f9ea410f95"
"bbc4b0e0-17e2-4ea5-8fea-79b3af14d7d1",
"bbc4b0e0-17e2-4ea5-8fea-79b3af14d7d1"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
Expand All @@ -41,16 +44,16 @@
"14999"
],
"x-ms-correlation-request-id": [
"62507eef-c3eb-4d0d-933d-d5ae500ea54a"
"af505e24-a7f1-4594-a508-49d9fd15324c"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150608T105955Z:62507eef-c3eb-4d0d-933d-d5ae500ea54a"
"CENTRALUS:20150612T211023Z:af505e24-a7f1-4594-a508-49d9fd15324c"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Mon, 08 Jun 2015 10:59:54 GMT"
"Fri, 12 Jun 2015 21:10:22 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/protectionpolicies/3b270816-9802-4384-8657-4f6a91981b89?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vcHJvdGVjdGlvbnBvbGljaWVzLzNiMjcwODE2LTk4MDItNDM4NC04NjU3LTRmNmE5MTk4MWI4OT9hcGktdmVyc2lvbj0yMDE0LTA5LTAx",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"policyname\": \"ProtPolicy01_updated\",\r\n \"schedule\": {\r\n \"BackupType\": \"Full\",\r\n \"ScheduleRun\": \"Daily\",\r\n \"ScheduleStartTime\": \"0001-01-01T00:00:00\",\r\n \"ScheduleRunDays\": [],\r\n \"ScheduleRunTimes\": [\r\n \"2015-06-12T19:30:00\"\r\n ],\r\n \"RetentionPolicy\": {\r\n \"RetentionType\": \"Days\",\r\n \"RetentionDuration\": 30\r\n }\r\n }\r\n}",
"RequestHeaders": {
"Content-Type": [
"application/json"
],
"Content-Length": [
"360"
],
"Accept-Language": [
"en-us"
],
"x-ms-client-request-id": [
"0eb26d57-da4f-4980-a943-a77c9c6be6e0"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "\"00000000-0000-0000-0000-000000000000\"",
"ResponseHeaders": {
"Content-Length": [
"38"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"fa23f963-8b54-4478-994c-c11c5b6f8db4"
],
"x-ms-client-request-id": [
"0eb26d57-da4f-4980-a943-a77c9c6be6e0",
"0eb26d57-da4f-4980-a943-a77c9c6be6e0"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1198"
],
"x-ms-correlation-request-id": [
"fa23f963-8b54-4478-994c-c11c5b6f8db4"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150612T211917Z:fa23f963-8b54-4478-994c-c11c5b6f8db4"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 12 Jun 2015 21:19:17 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<add key="WorkloadType" value="VM"/>
<add key="BackupType" value="Full"/>
<add key="ScheduleType" value="Daily"/>
<add key="PolicyId" value=""/>
<add key="PolicyId" value="3b270816-9802-4384-8657-4f6a91981b89"/>
<add key="RetentionType" value="Days"/>
<add key="RetentionDuration" value="30"/>
<add key="ModifiedPolicyName" value="ProtPolicy01_updated"/>
Expand Down

0 comments on commit 3a36f4e

Please sign in to comment.