Skip to content

Commit a3cfeae

Browse files
committed
Merge pull request #28 from MabOneSdk/panbha15
TestCases
2 parents a024d1c + 39907df commit a3cfeae

File tree

6 files changed

+194
-5
lines changed

6 files changed

+194
-5
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<appSettings>
4-
<add key="ResourceName" value="swatirn1" />
5-
<add key="ResourceGroupName" value="swatirg1" />
4+
<add key="ResourceName" value="backuprn" />
5+
<add key="ResourceGroupName" value="backuprg" />
66
<add key="ResourceId" value="7368183945769329045" />
77
<add key="ClientSettingsProvider.ServiceUri" value="" />
88
</appSettings>

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@
153153
</None>
154154
<None Include="ScenarioTests\AzureBackupTests.ps1">
155155
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
156-
</None>
156+
</None>
157+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\BackUpAzureBackUpItem.json" />
158+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\GetRecoveryPointTests.json" />
157159
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\ListProtectionPolicyTests.json">
158160
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
159161
</None>

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@ public void ListProtectionPolicyTests()
2424
{
2525
this.RunPowerShellTest("Test-GetAzureBackupProtectionPolicyTests");
2626
}
27+
28+
[Fact]
29+
public void GetRecoveryPointTests()
30+
{
31+
this.RunPowerShellTest("GetAzureRecoveryPointTest");
32+
}
33+
34+
[Fact]
35+
public void BackUpAzureBackUpItem()
36+
{
37+
this.RunPowerShellTest("BackUpAzureBackUpItemTest");
38+
}
2739
}
2840
}

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
$ResourceGroupName = "swatirg1";
16-
$ResourceName = "swatirn1"
15+
$ResourceGroupName = "backuprg";
16+
$ResourceName = "backuprn"
17+
$ContainerName = "iaasvmcontainer;dev01testing;dev01testing"
18+
$ContainerType = "IaasVMContainer"
19+
$DataSourceType = "VM"
20+
$DataSourceId = "17593283453810"
21+
$Location = "SouthEast Asia"
1722

1823
<#
1924
.SYNOPSIS
@@ -36,4 +41,36 @@ function Test-GetAzureBackupProtectionPolicyTests
3641
}
3742
}
3843

44+
function GetAzureRecoveryPointTest
45+
{
46+
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
47+
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
48+
$azureBackUpItem.ResourceName = $ResourceGroupName
49+
$azureBackUpItem.Location = $Location
50+
$azureBackUpItem.ContainerUniqueName = $ContainerName
51+
$azureBackUpItem.ContainerType = $ContainerType
52+
$azureBackUpItem.DataSourceId = $DataSourceId
53+
$azureBackUpItem.Type = $DataSourceType
54+
$recoveryPoints = Get-AzureBackupRecoveryPoint -item $azureBackUpItem
55+
Assert-NotNull $recoveryPoints 'Recovery Points should not be null'
56+
foreach($recoveryPoint in $recoveryPoints)
57+
{
58+
Assert-NotNull $recoveryPoint.RecoveryPointTime 'RecoveryPointTime should not be null'
59+
Assert-NotNull $recoveryPoint.RecoveryPointType 'RecoveryPointType should not be null'
60+
}
61+
}
62+
63+
function BackUpAzureBackUpItemTest
64+
{
65+
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
66+
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
67+
$azureBackUpItem.ResourceName = $ResourceName
68+
$azureBackUpItem.Location = $Location
69+
$azureBackUpItem.ContainerUniqueName = $ContainerName
70+
$azureBackUpItem.ContainerType = $ContainerType
71+
$azureBackUpItem.DataSourceId = $DataSourceId
72+
$azureBackUpItem.Type = $DataSourceType
73+
$operationId = Backup-AzureBackupItem -item $azureBackUpItem
74+
}
75+
3976

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/backup?api-version=2014-09-01",
5+
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvYmFja3VwP2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=",
6+
"RequestMethod": "POST",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"Accept-Language": [
10+
"en-us"
11+
],
12+
"User-Agent": [
13+
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
14+
]
15+
},
16+
"ResponseBody": "\"062c55cd-a201-4464-a628-4ee1cc20397a\"",
17+
"ResponseHeaders": {
18+
"Content-Length": [
19+
"38"
20+
],
21+
"Content-Type": [
22+
"application/json"
23+
],
24+
"Expires": [
25+
"-1"
26+
],
27+
"Pragma": [
28+
"no-cache"
29+
],
30+
"x-ms-request-id": [
31+
"7bd6b748-c6b1-4bf1-8583-841a4292e5aa"
32+
],
33+
"x-ms-client-request-id": [
34+
"76b831b2-0644-4703-becd-5831a9deae65",
35+
"76b831b2-0644-4703-becd-5831a9deae65"
36+
],
37+
"Strict-Transport-Security": [
38+
"max-age=31536000; includeSubDomains"
39+
],
40+
"x-ms-ratelimit-remaining-subscription-writes": [
41+
"1197"
42+
],
43+
"x-ms-correlation-request-id": [
44+
"7bd6b748-c6b1-4bf1-8583-841a4292e5aa"
45+
],
46+
"x-ms-routing-request-id": [
47+
"CENTRALUS:20150612T143521Z:7bd6b748-c6b1-4bf1-8583-841a4292e5aa"
48+
],
49+
"Cache-Control": [
50+
"no-cache"
51+
],
52+
"Date": [
53+
"Fri, 12 Jun 2015 14:35:21 GMT"
54+
],
55+
"Server": [
56+
"Microsoft-IIS/8.0"
57+
],
58+
"X-Powered-By": [
59+
"ASP.NET"
60+
]
61+
},
62+
"StatusCode": 202
63+
}
64+
],
65+
"Names": {},
66+
"Variables": {
67+
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/recoverypoints?api-version=2014-09-01",
5+
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvcmVjb3Zlcnlwb2ludHM/YXBpLXZlcnNpb249MjAxNC0wOS0wMQ==",
6+
"RequestMethod": "GET",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"Accept-Language": [
10+
"en-us"
11+
],
12+
"User-Agent": [
13+
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
14+
]
15+
},
16+
"ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-11T10:52:30.0345282Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"19591702463836\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T06:05:46.9189974Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"20483888156836\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T05:49:51.2034409Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"20920255378610\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T06:24:33.0768703Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"26453384139263\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-11T14:41:46.0950893Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"32528401668178\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 5,\r\n \"Skiptoken\": null\r\n}",
17+
"ResponseHeaders": {
18+
"Content-Length": [
19+
"1006"
20+
],
21+
"Content-Type": [
22+
"application/json"
23+
],
24+
"Expires": [
25+
"-1"
26+
],
27+
"Pragma": [
28+
"no-cache"
29+
],
30+
"x-ms-request-id": [
31+
"3e21bbb3-afb6-4d88-a2f7-4af14d817853"
32+
],
33+
"x-ms-client-request-id": [
34+
"0762a614-5fd9-468c-97f1-f0742060deef",
35+
"0762a614-5fd9-468c-97f1-f0742060deef"
36+
],
37+
"Strict-Transport-Security": [
38+
"max-age=31536000; includeSubDomains"
39+
],
40+
"x-ms-ratelimit-remaining-subscription-reads": [
41+
"14996"
42+
],
43+
"x-ms-correlation-request-id": [
44+
"3e21bbb3-afb6-4d88-a2f7-4af14d817853"
45+
],
46+
"x-ms-routing-request-id": [
47+
"CENTRALUS:20150612T133209Z:3e21bbb3-afb6-4d88-a2f7-4af14d817853"
48+
],
49+
"Cache-Control": [
50+
"no-cache"
51+
],
52+
"Date": [
53+
"Fri, 12 Jun 2015 13:32:08 GMT"
54+
],
55+
"Server": [
56+
"Microsoft-IIS/8.0"
57+
],
58+
"X-Powered-By": [
59+
"ASP.NET"
60+
]
61+
},
62+
"StatusCode": 200
63+
}
64+
],
65+
"Names": {},
66+
"Variables": {
67+
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
68+
}
69+
}

0 commit comments

Comments
 (0)