Skip to content

Dev #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jan 1, 2016
Merged

Dev #291

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.WebSites, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.1.0.0-preview\lib\net45\Microsoft.Azure.Management.Websites.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.Websites, Version=1.0.0.2, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.1.0.2-preview\lib\net45\Microsoft.Azure.Management.Websites.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -141,6 +141,7 @@
<ItemGroup>
<Compile Include="NewAzureWebsitesCommandTests.cs" />
<Compile Include="ScenarioTests\AppServicePlanTests.cs" />
<Compile Include="ScenarioTests\SSLBindingTests.cs" />
<Compile Include="ScenarioTests\WebAppSlotTests.cs" />
<Compile Include="ScenarioTests\WebsitesController.cs" />
<Compile Include="ScenarioTests\WebAppTests.cs" />
Expand All @@ -158,6 +159,9 @@
<None Include="ScenarioTests\AppServicePlanTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\SSLBindingTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\WebAppSlotTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -179,6 +183,21 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestSetAppServicePlan.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.SSLBindingTests\TestCreateNewWebAppSSLBinding.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.SSLBindingTests\TestGetNewWebAppSSLBinding.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.SSLBindingTests\TestGetWebAppCertificate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.SSLBindingTests\TestRemoveNewWebAppSSLBinding.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.SSLBindingTests\TestWebAppSSLBindingPipeSupport.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestCloneWebAppSlot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------


using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests
{
public class SSLBindingTests : RMTestBase
{
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewWebAppSSLBinding()
{
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppSSLBinding");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetNewWebAppSSLBinding()
{
WebsitesController.NewInstance.RunPsTest("Test-GetNewWebAppSSLBinding");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveNewWebAppSSLBinding()
{
WebsitesController.NewInstance.RunPsTest("Test-RemoveNewWebAppSSLBinding");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestWebAppSSLBindingPipeSupport()
{
WebsitesController.NewInstance.RunPsTest("Test-WebAppSSLBindingPipeSupport");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetWebAppCertificate()
{
WebsitesController.NewInstance.RunPsTest("Test-GetWebAppCertificate");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<# If you want to run these tests live then create a Basic/Standard/Premium web app,
assign a custom domain to it and update global variable values.
#>

#Global variables
$rgname = "webappsslbindingrb"
$appname = "webappsslbindingtest"
$slot = "testslot"
$prodHostname = "www.webappsslbindingtests.com"
$slotHostname = "testslot.webappsslbindingtests.com"
$thumbprint = "40D6600B0B8740C41BA4B3D13B967DDEF6ED1918"

<#
.SYNOPSIS
Tests creating a new Web App SSL binding.
#>
function Test-CreateNewWebAppSSLBinding
{
try
{
# Test - Create Ssl binding for web app
$createResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint
Assert-AreEqual $prodHostname $createResult.Name

# Test - Create Ssl binding for web app slot
$createResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Thumbprint $thumbprint
Assert-AreEqual $slotHostname $createResult.Name
}
finally
{
# Cleanup
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force
}
}

<#
.SYNOPSIS
Tests retrieving Web App SSL binding.
#>
function Test-GetNewWebAppSSLBinding
{
try
{
# Setup - Create Ssl bindings
$createWebAppResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint
$createWebAppSlotResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Thumbprint $thumbprint

# Test - Get commands for web app
$getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname
Assert-AreEqual 2 $getResult.Count
$currentHostNames = $getResult | Select -expand Name
Assert-True { $currentHostNames -contains $createWebAppResult.Name }
$getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname
Assert-AreEqual $getResult.Name $createWebAppResult.Name

# Test - Get commands for web app slot
$getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot
Assert-AreEqual 1 $getResult.Count
$currentHostNames = $getResult | Select -expand Name
Assert-True { $currentHostNames -contains $createWebAppSlotResult.Name }
$getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname
Assert-AreEqual $getResult.Name $createWebAppSlotResult.Name
}
finally
{
# Cleanup
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force
}
}

<#
.SYNOPSIS
Tests removing Web App SSL binding.
#>
function Test-RemoveNewWebAppSSLBinding
{
try
{
# Setup - Create Ssl bindings
New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint
New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Thumbprint $thumbprint

# Tests - Removing binding from web app and web app slot
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force

# Assert
$res = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname
$currentHostNames = $res | Select -expand Name
Assert-False { $currentHostNames -contains $prodHostname }

$res = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot
$currentHostNames = $res | Select -expand Name
Assert-False { $currentHostNames -contains $slotHostName }
}
finally
{
# Cleanup
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force
}
}

<#
.SYNOPSIS
Tests executing Ssl binding cmdlets using pipe
#>
function Test-WebAppSSLBindingPipeSupport
{
try
{
# Setup - Retrieve web app and web app slot objects
$webapp = Get-AzureRMWebApp -ResourceGroupName $rgname -Name $appname
$webappslot = Get-AzureRMWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $slot

# Test - Create Ssl bindings using web app and web app slot objects
$createResult = $webapp | New-AzureRMWebAppSSLBinding -Name $prodHostName -Thumbprint $thumbprint
Assert-AreEqual $prodHostName $createResult.Name

$createResult = $webappslot | New-AzureRMWebAppSSLBinding -Name $slotHostName -Thumbprint $thumbprint
Assert-AreEqual $slotHostName $createResult.Name

# Test - Retrieve Ssl bindings using web app and web app slot objects
$getResult = $webapp | Get-AzureRMWebAppSSLBinding
Assert-AreEqual 2 $getResult.Count

$getResult = $webappslot | Get-AzureRMWebAppSSLBinding
Assert-AreEqual 1 $getResult.Count

# Test - Delete Ssl bindings using web app and web app slot objects
$webapp | Remove-AzureRMWebAppSSLBinding -Name $prodHostName -Force
$res = $webapp | Get-AzureRMWebAppSSLBinding
$currentHostNames = $res | Select -expand Name
Assert-False { $currentHostNames -contains $prodHostName }

$webappslot | Remove-AzureRMWebAppSSLBinding -Name $slotHostName -Force
$res = $webappslot | Get-AzureRMWebAppSSLBinding
$currentHostNames = $res | Select -expand Name
Assert-False { $currentHostNames -contains $slotHostName }
}
finally
{
# Cleanup
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostName -Force
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostName -Force
}
}

<#
.SYNOPSIS
Tests retrieving web app certificates
#>
function Test-GetWebAppCertificate
{
try
{
# Setup - Create Ssl bindings
New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint

# Tests - Retrieve web app certificate objects
$certificates = Get-AzureRMWebAppCertificate
$thumbprints = $certificates | Select -expand Thumbprint
Assert-True { $thumbprints -contains $thumbprint }

$certificate = Get-AzureRMWebAppCertificate -Thumbprint $thumbprint
Assert-AreEqual $thumbprint $certificate.Thumbprint
}
finally
{
# Cleanup
Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostName -Force
}
}
Loading