Skip to content

Commit

Permalink
Merge pull request #7 from muratiakos/psgallery
Browse files Browse the repository at this point in the history
Release 1.5.2
  • Loading branch information
muratiakos committed Feb 28, 2016
2 parents d35596c + 89d3249 commit 42f5a86
Show file tree
Hide file tree
Showing 26 changed files with 122 additions and 71 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@
- Fix code suggestions from `PSScriptAnalyzer`
- Test if expected commands are exported too

## 1.5.0 (Feb 28, 2016)
## 1.5.0 (Feb 27, 2016)
- Add `Test-PSUri` to test HTTP/HTTPS URIs
- Add `Test-PSWebConfig` to fully test all URIs and Connectionstrings from complete configurations
- Rename `PSAddress` to `PSUri`
- Add `ReplaceRules` to Connectionstring test results
- Add `PSWebConfig.TestResult` view for all tests

## 1.5.1 (Feb 28, 2016)
- Regenerate module manifest for PSGallery

## 1.5.2 (Feb 28, 2016)
- Refactor Pester tests and Fixtures
- Reorganize functions into subfolders
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 54 additions & 12 deletions PSWebConfig.psd1
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
#
# Module manifest for 'PSWebConfig' module
# Created by: Akos Murati <[email protected]>
# Generated on: 10/09/2015
# Generated on: 02/28/2016
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'PSWebConfig.psm1'

# Version number of this module.
ModuleVersion = '1.5.0.0'
ModuleVersion = '1.5.2.0'

# ID used to uniquely identify this module
GUID = '37abef2c-d883-46be-ce1a-53d16477d01d'

# Author of this module
Author = '[email protected]'
Author = 'Akos Murati ([email protected])'

# Company or vendor of this module
CompanyName = 'murati.hu'

# Copyright statement for this module
Copyright = '(c) 2016. All rights reserved.'
Copyright = '(c) 2016 murati.hu . All rights reserved.'

# Description of the functionality provided by this module
Description = 'PowerShell module for decrypting, inspecting and testing web.config and application config files in remote and local scenarios.'
Description = 'A PowerShell module for decrypting, inspecting and testing web.config and application config files in remote and local scenarios without the WebAdministration module.'

# Minimum version of the Windows PowerShell engine required by this module
# PowerShellVersion = ''
Expand All @@ -45,7 +46,7 @@ Description = 'PowerShell module for decrypting, inspecting and testing web.conf
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @('')
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand All @@ -54,10 +55,10 @@ Description = 'PowerShell module for decrypting, inspecting and testing web.conf
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
#TypesToProcess = @()
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
#FormatsToProcess = @('')
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()
Expand All @@ -78,25 +79,66 @@ FunctionsToExport = @(
)

# Cmdlets to export from this module
#CmdletsToExport = '*'
# CmdletsToExport = '*'

# Variables to export from this module
# VariablesToExport = '*'

# Aliases to export from this module
# AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess
# PrivateData = ''
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @(
'web.config',
'app.config',

'decrypt',
'test',
'inspect',
'connectionString',
'appSetting',
'endpoint',

'IIS',
'aspnet_regiis',
'config',
'configuration',
'section',
'WebAdministration'
)

# A URL to the license for this module.
LicenseUri = 'https://github.com/muratiakos/PSWebConfig/blob/master/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/muratiakos/PSWebConfig'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''
HelpInfoURI = 'https://github.com/muratiakos/PSWebConfig'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions Tests/Import-LocalModule.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Load module from the local filesystem, instead from the ModulePath
Remove-Module PSWebConfig -Force -ErrorAction SilentlyContinue
Import-Module (Split-Path $PSScriptRoot -Parent)

$script:FunctionPath = Resolve-Path (Join-Path $PSScriptRoot '../Functions')
$script:FixturePath = Resolve-Path (Join-Path $PSScriptRoot 'Fixtures')
4 changes: 2 additions & 2 deletions Tests/Module.tests.ps1 → Tests/Module/Module.tests.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
. (Join-Path $PSScriptRoot Import-LocalModule.ps1)
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$moduleName = 'PSWebConfig'
$exportedCommands = (Get-Command -Module $moduleName)
$expectedCommands = @(
'Get-PSWebConfig'
'Test-PSWebConfig'

'Get-PSAppSetting'

'Get-PSConnectionString'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
. (Join-Path $PSScriptRoot Import-LocalModule.ps1)
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$functionFolder = Resolve-Path -Relative "$PSScriptRoot/../Functions"
$scriptSources = Get-ChildItem -Path $functionFolder -Filter '*.ps1' -Recurse
$scriptSources = Get-ChildItem -Path $script:FunctionPath -Filter '*.ps1' -Recurse
$scriptAnalyzer = Get-Module PSScriptAnalyzer -ListAvailable

if (-Not $scriptAnalyzer) {
Expand All @@ -25,7 +24,7 @@ Describe "Script Source analysis" {
Where-Object Severity -eq "Warning" |
Should BeNullOrEmpty
}

}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
. (Join-Path $PSScriptRoot Import-LocalModule.ps1)
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$TestVerbose=$false
$isVerbose=($VerbosePreference -eq 'Continue')

$webConfigFolder = Join-Path $PSScriptRoot 'ConfigTests'
$webConfigFile = Join-Path $webConfigFolder 'web.config'
$webConfigFile = Join-Path $script:FixturePath 'web.config'

Describe 'Get-PSAppSetting' {
Context 'Local web.config' {
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$TestVerbose
$appSettings = $config | Get-PSAppSetting -Verbose:$TestVerbose
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$isVerbose
$appSettings = $config | Get-PSAppSetting -Verbose:$isVerbose

It 'should return all AppSettings' {
$appSettings | Should Not BeNullOrEmpty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
. (Join-Path $PSScriptRoot Import-LocalModule.ps1)
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$TestVerbose=$false
$isVerbose=($VerbosePreference -eq 'Continue')

$webConfigFolder = Join-Path $PSScriptRoot 'ConfigTests'
$webConfigFile = Join-Path $webConfigFolder 'web.config'
$webConfigFile = Join-Path $script:FixturePath 'web.config'

Describe "Get-PSConnectionString" {
Context "Local web.config connectionStrings section" {
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$TestVerbose
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$isVerbose

It "should return only connectionStrings by default" {
$connStrs = $config | Get-PSConnectionString -Verbose:$TestVerbose
$connStrs = $config | Get-PSConnectionString -Verbose:$isVerbose
$connStrs | Should Not BeNullOrEmpty
$connStrs.GetType().Name | Should Be "XmlElement"
$connStrs.psobject.TypeNames -contains 'PSWebConfig.ConnectionString' | Should Be $true
Expand All @@ -21,7 +20,7 @@ Describe "Get-PSConnectionString" {
}

It "should return connectionStrings with -IncludeAppSettings" {
$connStrs = $config | Get-PSConnectionString -IncludeAppSettings -Verbose:$TestVerbose
$connStrs = $config | Get-PSConnectionString -IncludeAppSettings -Verbose:$isVerbose
$connStrs | Should Not BeNullOrEmpty
$connStrs.Count | Should Be 2
$connStrs | Foreach-Object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
$isVerbose=($VerbosePreference -eq 'Continue')
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$isVerbose=($VerbosePreference -eq 'Continue')

Describe "Test_ConnectionString helper function" {
# Function to test
. (Join-Path $PSScriptRoot '..\Functions\Test_ConnectionString.ps1')
. (Join-Path $script:FunctionPath 'PSConnectionString/Test_ConnectionString.ps1')

@{
Invalid='IvServer=localhost;IvDatabase=##DB##;Connection Timeout=1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
. (Join-Path $PSScriptRoot Import-LocalModule.ps1)
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$TestVerbose=$false
$isVerbose=($VerbosePreference -eq 'Continue')

$webConfigFolder = Join-Path $PSScriptRoot 'ConfigTests'
$webConfigFile = Join-Path $webConfigFolder 'web.config'
$webConfigFile = Join-Path $script:FixturePath 'web.config'

Describe "Get-PSEndpoint" {
Context "Local web.config" {
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$TestVerbose
$endpoints = $config | Get-PSEndpoint -Verbose:$TestVerbose
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$isVerbose
$endpoints = $config | Get-PSEndpoint -Verbose:$isVerbose

It "should return all client endpoints as an address" {
$endpoints | Should Not BeNullOrEmpty
Expand Down
11 changes: 5 additions & 6 deletions Tests/Get-PSUri.tests.ps1 → Tests/PSUri/Get-PSUri.tests.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
. (Join-Path $PSScriptRoot Import-LocalModule.ps1)
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$TestVerbose=$false
$isVerbose=($VerbosePreference -eq 'Continue')

$webConfigFolder = Join-Path $PSScriptRoot 'ConfigTests'
$webConfigFile = Join-Path $webConfigFolder 'web.config'
$webConfigFile = Join-Path $script:FixturePath 'web.config'

Describe 'Get-PSUri' {
Context 'Local web.config' {
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$TestVerbose
$addresses = $config | Get-PSUri -Verbose:$TestVerbose
$config = Get-PSWebConfig -Path $webConfigFile -Verbose:$isVerbose
$addresses = $config | Get-PSUri -Verbose:$isVerbose

It 'should return all addresses' {
$addresses | Should Not BeNullOrEmpty
Expand Down
8 changes: 5 additions & 3 deletions Tests/Test_Uri.tests.ps1 → Tests/PSUri/Test_Uri.tests.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
$isVerbose=($VerbosePreference -eq 'Continue')
. (Join-Path $PSScriptRoot '../Import-LocalModule.ps1')

$isVerbose=($VerbosePreference -eq 'Continue')

Describe "Test_Uri helper function" {
# Function to test
. (Join-Path $PSScriptRoot '..\Functions\Test_Uri.ps1')
. (Join-Path $script:FunctionPath 'PSUri/Test_Uri.ps1')

Context "Testing multiple URIs and StatusCodes" {
$uriTests = Import-Csv -LiteralPath (Join-Path $PSScriptRoot 'ConfigTests/webrequest-tests.csv') -Delimiter ','
$uriTests = Import-Csv -LiteralPath (Join-Path $script:FixturePath 'webrequests.csv') -Delimiter ','

foreach ($uriTest in $uriTests) {
$verb = 'fail'
Expand Down
Loading

0 comments on commit 42f5a86

Please sign in to comment.