diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 393a39c..6dcf3ca 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -32,7 +32,7 @@ about: Create a report to help us improve > ```powershell -> Get-Module AtlassianPS.Configuration -ListAvailable | Select Name, Version +> Get-Module ConfluencePS -ListAvailable | Select Name, Version > $PSVersionTable > ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index d3f2ba0..f554504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/). . +## [2.4] 2018-12-12 + +### Added + +- Added `-Vertical` to `ConvertTo-Table` (#148, [@brianbunke]) +- Added support for TLS1.2 (#155, [@lipkau]) + +### Changed + +- Changed productive module files to be compiled into single `.psm1` file (#133, [@lipkau]) +- Fixed `ConvertTo-Table` for empty cells (#144, [@FelixMelchert]) +- Changed CI/CD pipeline from AppVeyor to Azure DevOps (#150, [@lipkau]) +- Fixed trailing slash in ApiURi parameter (#153, [@lipkau]) + ## [2.3] 2018-03-22 ### Added @@ -167,6 +181,7 @@ No changelog available for version `1.0` of ConfluencePS. `1.0` was created in l [@colhal]: /~https://github.com/colhal [@Dejulia489]: /~https://github.com/Dejulia489 [@ebekker]: /~https://github.com/ebekker +[@FelixMelchert]: /~https://github.com/FelixMelchert [@jkknorr]: /~https://github.com/jkknorr [@JohnAdders]: /~https://github.com/JohnAdders [@kittholland]: /~https://github.com/kittholland diff --git a/ConfluencePS.build.ps1 b/ConfluencePS.build.ps1 index aac7a42..85e2c31 100644 --- a/ConfluencePS.build.ps1 +++ b/ConfluencePS.build.ps1 @@ -59,9 +59,9 @@ task InstallDependencies { # Synopsis: Get the next version for the build task GetNextVersion { + $manifestVersion = [Version](Get-Metadata -Path $env:BHPSModuleManifest) try { $env:CurrentOnlineVersion = [Version](Find-Module -Name $env:BHProjectName).Version - $manifestVersion = [Version](Get-Metadata -Path $env:BHPSModuleManifest) $nextOnlineVersion = Get-NextNugetPackageVersion -Name $env:BHProjectName if ( ($manifestVersion.Major -gt $nextOnlineVersion.Major) -or @@ -250,7 +250,6 @@ task Test Init, { } $testResults = Invoke-Pester @parameter - Write-Host (Get-Childitem $env:BHProjectPath) Assert-True ($testResults.FailedCount -eq 0) "$($testResults.FailedCount) Pester test(s) failed." } catch { diff --git a/ConfluencePS/ConfluencePS.psd1 b/ConfluencePS/ConfluencePS.psd1 index 1df1197..338efc7 100644 --- a/ConfluencePS/ConfluencePS.psd1 +++ b/ConfluencePS/ConfluencePS.psd1 @@ -12,7 +12,7 @@ RootModule = 'ConfluencePS.psm1' # Version number of this module. - ModuleVersion = '2.3' + ModuleVersion = '2.4' # ID used to uniquely identify this module GUID = '20d32089-48ef-464d-ba73-6ada240e26b3' diff --git a/ConfluencePS/Private/Set-TlsLevel.ps1 b/ConfluencePS/Private/Set-TlsLevel.ps1 new file mode 100644 index 0000000..6629053 --- /dev/null +++ b/ConfluencePS/Private/Set-TlsLevel.ps1 @@ -0,0 +1,26 @@ +function Set-TlsLevel { + [CmdletBinding( SupportsShouldProcess = $false )] + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')] + param ( + [Parameter(Mandatory, ParameterSetName = 'Set')] + [Switch]$Tls12, + + [Parameter(Mandatory, ParameterSetName = 'Revert')] + [Switch]$Revert + ) + + begin { + switch ($PSCmdlet.ParameterSetName) { + "Set" { + $Script:OriginalTlsSettings = [Net.ServicePointManager]::SecurityProtocol + + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + } + "Revert" { + if ($Script:OriginalTlsSettings) { + [Net.ServicePointManager]::SecurityProtocol = $Script:OriginalTlsSettings + } + } + } + } +} diff --git a/ConfluencePS/Public/ConvertTo-Table.ps1 b/ConfluencePS/Public/ConvertTo-Table.ps1 index d9d3bff..ac150e4 100644 --- a/ConfluencePS/Public/ConvertTo-Table.ps1 +++ b/ConfluencePS/Public/ConvertTo-Table.ps1 @@ -8,45 +8,58 @@ function ConvertTo-Table { )] $Content, - [switch]$NoHeader + [Switch]$Vertical, + + [Switch]$NoHeader ) BEGIN { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" - $RowArray = New-Object System.Collections.ArrayList + $sb = [System.Text.StringBuilder]::new() } PROCESS { Write-Debug "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)" Write-Debug "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)" - If ($NoHeader) { - $HeaderGenerated = $true - } + $HeaderGenerated = $NoHeader # This ForEach needed if the content wasn't piped in $Content | ForEach-Object { - # First row enclosed by ||, all other rows by | - If (!$HeaderGenerated) { - $_.PSObject.Properties | - ForEach-Object -Begin {$Header = ""} ` - -Process {$Header += "||$($_.Name)"} ` - -End {$Header += "||"} - $RowArray.Add($Header) | Out-Null - $HeaderGenerated = $true + If ($Vertical) { + If ($HeaderGenerated) {$pipe = '|'} + Else {$pipe = '||'} + + # Put an empty row between multiple tables (objects) + If ($Spacer) { + $null = $sb.AppendLine('') + } + + $_.PSObject.Properties | ForEach-Object { + $row = ("$pipe {0} $pipe {1} |" -f $_.Name, $_.Value) -replace "\|\s\s", "| " + $null = $sb.AppendLine($row) + } + + $Spacer = $true + } Else { + # Header row enclosed by || + If (-not $HeaderGenerated) { + $null = $sb.AppendLine("|| {0} ||" -f ($_.PSObject.Properties.Name -join " || ")) + $HeaderGenerated = $true + } + + # All other rows enclosed by | + $row = ("| " + ($_.PSObject.Properties.Value -join " | ") + " |") -replace "\|\s\s", "| " + $null = $sb.AppendLine($row) } - $_.PSObject.Properties | - ForEach-Object -Begin {$Row = ""} ` - -Process {if ($($_.value)) {$Row += "|$($_.Value)"} else {$Row += "| "}} ` - -End {$Row += "|"} - $RowArray.Add($Row) | Out-Null } } END { - $RowArray | Out-String + # Return the array as one large, multi-line string + $sb.ToString() - Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ened" + Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended" } } diff --git a/ConfluencePS/Public/Get-Label.ps1 b/ConfluencePS/Public/Get-Label.ps1 index 84bf286..388786a 100644 --- a/ConfluencePS/Public/Get-Label.ps1 +++ b/ConfluencePS/Public/Get-Label.ps1 @@ -63,7 +63,6 @@ function Get-Label { $InputObject = Get-Page -PageID $_page -ApiURi $apiURi -Credential $Credential } $iwParameters["Uri"] = $resourceApi -f $_page - Write-debug "Hey" $output = New-Object -TypeName ConfluencePS.ContentLabelSet $output.Page = $InputObject $output.Labels += (Invoke-Method @iwParameters) diff --git a/ConfluencePS/Public/Invoke-Method.ps1 b/ConfluencePS/Public/Invoke-Method.ps1 index dac96d3..fb2c031 100644 --- a/ConfluencePS/Public/Invoke-Method.ps1 +++ b/ConfluencePS/Public/Invoke-Method.ps1 @@ -50,6 +50,13 @@ function Invoke-Method { BEGIN { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" + Set-TlsLevel -Tls12 + + # Sanitize double slash `//` + # Happens when the BaseUri is the domain name + # [Uri]"http://google.com" vs [Uri]"http://google.com/foo" + $URi = $URi -replace '(?A nice description
" @@ -123,11 +132,11 @@ InModuleScope ConfluencePS { } } - Describe 'Get-ConfluenceSpace' -Tag 'Integration' { + Context 'Get-ConfluenceSpace' { # ARRANGE # Set up test values: - $Key1 = "PESTER" - $Key2 = "PESTER1" + $Key1 = "PESTER$SpaceID" + $Key2 = "PESTER1$SpaceID" $Name1 = "Pester Test Space" $Name2 = "Second Pester Space" $Description = "A nice description
" @@ -149,10 +158,10 @@ InModuleScope ConfluencePS { ($GetSpace3 | Get-Member -MemberType Property).Count | Should Be 7 } It 'has the correct number of results' { - $AllSpaces.Count | Should BeGreaterThan 2 - $GetSpace1.Count | Should Be 1 - $GetSpace2.Count | Should Be 1 - $GetSpace3.Count | Should Be 2 + @($AllSpaces).Count | Should BeGreaterThan 2 + @($GetSpace1).Count | Should Be 1 + @($GetSpace2).Count | Should Be 1 + @($GetSpace3).Count | Should Be 2 } It 'id is integer' { $GetSpace1.ID | Should BeOfType [Int] @@ -214,7 +223,7 @@ InModuleScope ConfluencePS { } } - Describe 'ConvertTo-ConfluenceStorageFormat' -Tag 'Integration' { + Context 'ConvertTo-ConfluenceStorageFormat' { # ARRANGE $InputString = "Hi Pester!" $OutputString = "Hi Pester!
" @@ -237,15 +246,15 @@ InModuleScope ConfluencePS { } } - Describe 'New-ConfluencePage' -Tag 'Integration' { + Context 'New-ConfluencePage' { <# TODO: * Title may not be empty * Space may not be empty when no parent is provided #> # ARRANGE - $SpaceKey = "PESTER" - $parentPage = Get-ConfluencePage -Title "Pester Test Space Home" -SpaceKey "PESTER" -ErrorAction Stop + $SpaceKey = "PESTER$SpaceID" + $parentPage = Get-ConfluencePage -Title "Pester Test Space Home" -SpaceKey $SpaceKey -ErrorAction Stop $Title1 = "Pester New Page Piped" $Title2 = "Pester New Page Orphan" $Title3 = "Pester New Page from Object" @@ -329,15 +338,15 @@ InModuleScope ConfluencePS { } } - Describe 'Get-ConfluencePage' -Tag 'Integration' { + Context 'Get-ConfluencePage' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Title1 = "Pester New Page from Object" $Title2 = "Pester New Page Orphan" $Title3 = "Pester Test Space Home" $Title4 = "orphan" $Title5 = "*orphan" - $Query = "space=PESTER and title~`"*Object`"" + $Query = "space=PESTER$SpaceID and title~`"*Object`"" $ContentRaw = "Hi Pester!👋
" $ContentFormatted = "Hi Pester!
👋
" (Get-ConfluenceSpace -SpaceKey $SpaceKey).Homepage | Add-ConfluenceLabel -Label "important" -ErrorAction Stop @@ -358,17 +367,17 @@ InModuleScope ConfluencePS { # ASSERT It 'returns the correct amount of results' { - $GetTitle1.Count | Should Be 1 - $GetTitle2.Count | Should Be 1 - $GetPartial.Count | Should Be 0 - $GetWildcard.Count | Should Be 1 - $GetID1.Count | Should Be 1 - $GetID2.Count | Should Be 1 - $GetKeys.Count | Should Be 5 - $GetByLabel.Count | Should Be 1 - $GetSpacePage.Count | Should Be 5 - $GetByQuery.Count | Should Be 2 - $GetSpacePiped.Count | Should Be 5 + @($GetTitle1).Count | Should Be 1 + @($GetTitle2).Count | Should Be 1 + @($GetPartial).Count | Should Be 0 + @($GetWildcard).Count | Should Be 1 + @($GetID1).Count | Should Be 1 + @($GetID2).Count | Should Be 1 + @($GetKeys).Count | Should Be 5 + @($GetByLabel).Count | Should Be 1 + @($GetSpacePage).Count | Should Be 5 + @($GetByQuery).Count | Should Be 2 + @($GetSpacePiped).Count | Should Be 5 } It 'returns an object with specific properties' { $GetTitle1 | Should BeOfType [ConfluencePS.Page] @@ -408,7 +417,7 @@ InModuleScope ConfluencePS { $GetID2.Title | Should BeExactly $Title2 $GetKeys.Title -contains $Title3 | Should Be $true $GetKeys.Title -contains $GetID1.Title | Should Be $true - $GetByLabel.Title -like "PESTER * Home" | Should Be $true + $GetByLabel.Title -like "PESTER Test Space Home" | Should Be $true } It 'space matches the specified value' { $GetTitle1.Space.Key | Should BeExactly $SpaceKey @@ -425,9 +434,11 @@ InModuleScope ConfluencePS { $GetByLabel.Version.Number | Should Be 1 } It 'body matches the specified value' { - (ConvertFrom-HTMLEncoded $GetTitle1.Body) | Should BeExactly $ContentFormatted - (ConvertFrom-HTMLEncoded $GetTitle2.Body) | Should BeExactly $ContentRaw - (ConvertFrom-HTMLEncoded $GetID1.Body) | Should BeExactly $ContentFormatted + . "$env:BHProjectPath/$env:BHProjectName/Private/ConvertFrom-HTMLEncoded.ps1" + + ConvertFrom-HTMLEncoded $GetTitle1.Body | Should BeExactly $ContentFormatted + ConvertFrom-HTMLEncoded $GetTitle2.Body | Should BeExactly $ContentRaw + ConvertFrom-HTMLEncoded $GetID1.Body | Should BeExactly $ContentFormatted } It 'url is string' { $GetTitle1.URL | Should BeOfType [String] @@ -468,9 +479,9 @@ InModuleScope ConfluencePS { } } - Describe 'Add-ConfluenceLabel' -Tag 'Integration' { + Context 'Add-ConfluenceLabel' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -Title "Pester New Page Piped" -SpaceKey $SpaceKey -ErrorAction Stop $Label1 = "pestera", "pesterb", "pesterc" $Label2 = "pesterall" @@ -513,9 +524,9 @@ InModuleScope ConfluencePS { } } - Describe 'Set-ConfluenceLabel' -Tag 'Integration' { + Context 'Set-ConfluenceLabel' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Title1 = "Pester New Page from Object" $Label1 = @("overwrite", "remove") $Label2 = "final" @@ -544,8 +555,8 @@ InModuleScope ConfluencePS { It 'label matches the specified value' { $After1.Labels.Name | Should BeExactly $Label1 $After2.Labels.Name | Should BeExactly $Label2 - $After1.Labels.Name -notcontains $Before.Labels.Name | Should Be $true - $After2.Labels.Name -notcontains $Before.Labels.Name | Should Be $true + $After1.Labels.Name -notcontains $Before1.Labels.Name | Should Be $true + $After2.Labels.Name -notcontains $Before1.Labels.Name | Should Be $true } It 'labelid is not null or empty' { $After1.Labels.ID | Should Not BeNullOrEmpty @@ -553,9 +564,9 @@ InModuleScope ConfluencePS { } } - Describe 'Get-ConfluenceLabel' -Tag 'Integration' { + Context 'Get-ConfluenceLabel' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $patternLabel1 = "pester[abc]$" $patternLabel2 = "(pest|import|fin)" $Page = Get-ConfluencePage -Title "Pester New Page Piped" -SpaceKey $SpaceKey @@ -594,7 +605,7 @@ InModuleScope ConfluencePS { } } - Describe 'Set-ConfluencePage' -Tag 'Integration' { + Context 'Set-ConfluencePage' { <# TODO: * Title may not be empty * fails when version is 1 larger than current version @@ -630,7 +641,7 @@ InModuleScope ConfluencePS { } } - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Piped" $Page2 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Orphan" $Page3 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page from Object" @@ -670,15 +681,15 @@ InModuleScope ConfluencePS { # ASSERT It 'returns the correct amount of results' { - $SetPage1.Count | Should Be 1 - $SetPage2.Count | Should Be 1 - $SetPage3.Count | Should Be 1 - $SetPage4.Count | Should Be 1 - $SetPage5.Count | Should Be 1 - $SetPage6.Count | Should Be 1 - $SetPage7.Count | Should Be 1 - $SetPage8.Count | Should Be 1 - $AllChangedPages.Count | Should Be 9 + @($SetPage1).Count | Should Be 1 + @($SetPage2).Count | Should Be 1 + @($SetPage3).Count | Should Be 1 + @($SetPage4).Count | Should Be 1 + @($SetPage5).Count | Should Be 1 + @($SetPage6).Count | Should Be 1 + @($SetPage7).Count | Should Be 1 + @($SetPage8).Count | Should Be 1 + @($AllChangedPages).Count | Should Be 9 } It 'returns an object with specific properties' { $SetPage1 | Should BeOfType [ConfluencePS.Page] @@ -766,12 +777,12 @@ InModuleScope ConfluencePS { } } - Describe 'Get-ConfluenceChildPage' -Tag 'Integration' { + Context 'Get-ConfluenceChildPage' { # ARRANGE # ACT - $ChildPages = (Get-ConfluenceSpace -SpaceKey PESTER).Homepage | Get-ConfluenceChildPage - $DesendantPages = (Get-ConfluenceSpace -SpaceKey PESTER).Homepage | Get-ConfluenceChildPage -Recurse + $ChildPages = (Get-ConfluenceSpace -SpaceKey "PESTER$SpaceID").Homepage | Get-ConfluenceChildPage + $DesendantPages = (Get-ConfluenceSpace -SpaceKey "PESTER$SpaceID").Homepage | Get-ConfluenceChildPage -Recurse # ASSERT It 'returns the correct amount of results' { @@ -784,7 +795,7 @@ InModuleScope ConfluencePS { } } - Describe 'Add-ConfluenceAttachment' -Tag 'Integration' { + Context 'Add-ConfluenceAttachment' { # ARRANGE BeforeAll { $originalWarningPreference = $WarningPreference @@ -793,7 +804,7 @@ InModuleScope ConfluencePS { AfterAll { $WarningPreference = $originalWarningPreference } - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Piped" -ErrorAction Stop $Page2 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Orphan" -ErrorAction Stop $Page3 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page from Object" -ErrorAction Stop @@ -865,9 +876,9 @@ InModuleScope ConfluencePS { } } - Describe 'Get-ConfluenceAttachment' -Tag 'Integration' { + Context 'Get-ConfluenceAttachment' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Piped" -ErrorAction Stop $Page2 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Orphan" -ErrorAction Stop $Page3 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page from Object" -ErrorAction Stop @@ -910,7 +921,7 @@ InModuleScope ConfluencePS { } } - Describe 'Get-ConfluenceAttachmentFile' -Tag 'Integration' { + Context 'Get-ConfluenceAttachmentFile' { # ARRANGE BeforeAll { Push-Location -Path "TestDrive:\" @@ -921,7 +932,7 @@ InModuleScope ConfluencePS { $null = New-Item -Path "TestDrive:\Folder1" -ItemType Directory $null = New-Item -Path "TestDrive:\Folder2" -ItemType Directory $null = New-Item -Path "TestDrive:\Folder3" -ItemType Directory - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Piped" -ErrorAction Stop $Page2 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Orphan" -ErrorAction Stop $Attachments = $Page1, $Page2 | Get-ConfluenceAttachment -ErrorAction Stop @@ -964,9 +975,9 @@ InModuleScope ConfluencePS { } } - Describe 'Set-ConfluenceAttachment' -Tag 'Integration' { + Context 'Set-ConfluenceAttachment' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Piped" -ErrorAction Stop $Attachment = $Page1 | Get-ConfluenceAttachment -FileNameFilter "Test.txt" -ErrorAction Stop $TextFile = Get-Item -Path "$PSScriptRoot/resources/Test.txt" @@ -1012,7 +1023,7 @@ InModuleScope ConfluencePS { } } - Describe 'Remove-ConfluenceAttachment' -Tag 'Integration' { + Context 'Remove-ConfluenceAttachment' { # ARRANGE BeforeAll { $originalWarningPreference = $WarningPreference @@ -1021,7 +1032,7 @@ InModuleScope ConfluencePS { AfterAll { $WarningPreference = $originalWarningPreference } - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Page1 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Piped" -ErrorAction Stop $Page2 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page Orphan" -ErrorAction Stop $Page3 = Get-ConfluencePage -SpaceKey $SpaceKey -Title "Pester New Page from Object" -ErrorAction Stop @@ -1054,12 +1065,12 @@ InModuleScope ConfluencePS { } } - Describe 'Remove-ConfluenceLabel' -Tag 'Integration' { + Context 'Remove-ConfluenceLabel' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Label1 = "pesterc" $Page1 = Get-ConfluencePage -Title 'Pester New Page Piped' -SpaceKey $SpaceKey -ErrorAction Stop - $Page2 = (Get-ConfluenceSpace -SpaceKey PESTER).Homepage + $Page2 = (Get-ConfluenceSpace -SpaceKey $SpaceKey).Homepage # ACT $Before1 = $Page1 | Get-ConfluenceLabel -ErrorAction SilentlyContinue @@ -1071,18 +1082,18 @@ InModuleScope ConfluencePS { # ASSERT It 'page has one label less' { - ($Before1.Labels).Count - ($After1.Labels).Count| Should Be 1 - ($Before2.Labels).Count - ($After2.Labels).Count| Should Be 2 + @($Before1.Labels).Count - @($After1.Labels).Count | Should Be 1 + ($After1.Labels).Name -notcontains $Label1 | Should Be $true } It 'page does not have labels' { - $After1.Labels.Name -notcontains $Label1 | Should Be $true - $After2.Labels.Name -notcontains $Label1 | Should Be $true + @($Before2.Labels).Count | Should Be 2 + $After2.Labels | Should BeNullOrEmpty } } - Describe 'Remove-ConfluencePage' -Tag 'Integration' { + Context 'Remove-ConfluencePage' { # ARRANGE - $SpaceKey = "PESTER" + $SpaceKey = "PESTER$SpaceID" $Title = "Pester New Page Orphan" $PageID = Get-ConfluencePage -Title $Title -SpaceKey $SpaceKey -ErrorAction Stop $Before = Get-ConfluencePage -SpaceKey $SpaceKey -ErrorAction Stop @@ -1097,24 +1108,24 @@ InModuleScope ConfluencePS { $Before | Should Not BeNullOrEmpty } It 'space does not have pages after' { - $After.ID | Should BeNullOrEmpty + $After | Should BeNullOrEmpty } } - Describe 'Remove-ConfluenceSpace' -Tag 'Integration' { + Context 'Remove-ConfluenceSpace' { # ARRANGE # We don't want warnings on the screen $WarningPreference = 'SilentlyContinue' # ACT - Remove-ConfluenceSpace -Key PESTER -Force -ErrorAction Stop - "PESTER1" | Remove-ConfluenceSpace -Force -ErrorAction Stop + Remove-ConfluenceSpace -Key "PESTER$SpaceID" -Force -ErrorAction Stop + "PESTER1$SpaceID" | Remove-ConfluenceSpace -Force -ErrorAction Stop # ASSERT Start-Sleep -Seconds 20 It 'space is no longer available' { - { Get-ConfluenceSpace -Key PESTER -ErrorAction Stop } | Should Throw - { Get-ConfluenceSpace -Key PESTER1 -ErrorAction Stop } | Should Throw + { Get-ConfluenceSpace -Key "PESTER$SpaceID" -ErrorAction Stop } | Should Throw + { Get-ConfluenceSpace -Key "PESTER1$SpaceID" -ErrorAction Stop } | Should Throw } } } diff --git a/Tests/Project.Tests.ps1 b/Tests/Project.Tests.ps1 index 0eea233..79b2f88 100644 --- a/Tests/Project.Tests.ps1 +++ b/Tests/Project.Tests.ps1 @@ -36,17 +36,17 @@ Describe "General project validation" -Tag Unit { $module = Get-Module $env:BHProjectName $testFiles = Get-ChildItem $PSScriptRoot -Include "*.Tests.ps1" -Recurse - <# Context "Public functions" { $publicFunctions = (Get-ChildItem "$env:BHModulePath/Public/*.ps1").BaseName foreach ($function in $publicFunctions) { - It "has a test file for $function" { - $expectedTestFile = "$function.Unit.Tests.ps1" + # TODO + # It "has a test file for $function" { + # $expectedTestFile = "$function.Unit.Tests.ps1" - $testFiles.Name | Should -Contain $expectedTestFile - } + # $testFiles.Name | Should -Contain $expectedTestFile + # } It "exports $function" { $expectedFunctionName = $function -replace "\-", "-$($module.Prefix)" @@ -60,11 +60,13 @@ Describe "General project validation" -Tag Unit { $privateFunctions = (Get-ChildItem "$env:BHModulePath/Private/*.ps1").BaseName foreach ($function in $privateFunctions) { - It "has a test file for $function" { - $expectedTestFile = "$function.Unit.Tests.ps1" - $testFiles.Name | Should -Contain $expectedTestFile - } + # TODO + # It "has a test file for $function" { + # $expectedTestFile = "$function.Unit.Tests.ps1" + + # $testFiles.Name | Should -Contain $expectedTestFile + # } It "does not export $function" { $expectedFunctionName = $function -replace "\-", "-$($module.Prefix)" @@ -74,6 +76,7 @@ Describe "General project validation" -Tag Unit { } } + <# Context "Classes" { foreach ($class in ([AtlassianPS.ServerData].Assembly.GetTypes() | Where-Object IsClass)) { diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a59d9c3..b849fb0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -183,7 +183,11 @@ phases: Invoke-Build -Task ShowInfo displayName: Setup - - powershell: 'Invoke-Build -Task Test -Tag "Integration"' + - powershell: 'Invoke-Build -Task Test -Tag "Integration" -ExcludeTag ""' + env: + WikiURI: WikiURI + WikiUser: WikiUser + WikiPass: WikiPass displayName: Test - task: PublishTestResults@2 diff --git a/docs/en-US/commands/ConvertTo-Table.md b/docs/en-US/commands/ConvertTo-Table.md index 14f980e..acffb24 100644 --- a/docs/en-US/commands/ConvertTo-Table.md +++ b/docs/en-US/commands/ConvertTo-Table.md @@ -16,7 +16,7 @@ Convert your content to Confluence's wiki markup table format. ## SYNTAX ```powershell -ConvertTo-ConfluenceTable [-Content]