Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Tiennot committed Aug 18, 2020
1 parent 57c0130 commit 4ef5bcf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions SnowSQL/public/Open-SnowSqlConnection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Open-SnowSqlConnection
[int]
$Timeout = 10
)
begging
begin
{
if ($Endpoint -match '(http[s]?)(:\/\/)([^\s,]+)')
{
Expand All @@ -55,13 +55,21 @@ function Open-SnowSqlConnection
Connection = $SnowSqlConnection
timeout = $Timeout
}
$Result = Invoke-SnowSql @invokeSnowSqlSplat
if ($PSCmdlet.ShouldProcess("Execute SnowSql query [$($invokeSnowSqlSplat.query)] on [$Endpoint] as [$($Credential.UserName)]. Use -Debug to see full command"))
{
$Result = Invoke-SnowSql @invokeSnowSqlSplat
}
else
{
$Result = $true
}
if (-not $Result)
{
Write-Error ("Unable to connect to SnowSql endpoint {0}" -f $Endpoint) -ErrorAction Stop
}
else
{
$Script:SnowSqlConnection = $SnowSqlConnection
return $Script:SnowSqlConnection
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Get-SnowSqlConnection.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ InModuleScope SnowSQL {
Describe 'Function Get-SnowSqlConnection' -Tag Build {
It 'Get SnowSql Connection' {
Mock Invoke-SnowSql -Verifiable {}
Open-SnowSqlConnection -Endpoint "test" -Credential ([pscredential]::Empty)
Open-SnowSqlConnection -Endpoint "test" -Credential ([pscredential]::Empty) -WhatIf
Get-SnowSqlConnection | Should -Not -BeNullOrEmpty
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Open-SnowSqlConnection.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ InModuleScope SnowSql {
Describe 'Function Open-SnowSqlConnection' -Tag Build {
It 'Open SnowSql Connection ' {
Mock Invoke-SnowSql -Verifiable {}
Open-SnowSqlConnection -Endpoint "test" -Credential ([pscredential]::Empty)
Open-SnowSqlConnection -Endpoint "test" -Credential ([pscredential]::Empty) -Whatif
}
}
}

0 comments on commit 4ef5bcf

Please sign in to comment.