Skip to content

Commit d52aef1

Browse files
committed
add test
1 parent 9d5e6c1 commit d52aef1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

resources/sshdconfig/tests/sshdconfigRepeat.tests.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,23 @@ PasswordAuthentication yes
212212

213213
Remove-Item -Path $stderrFile -Force -ErrorAction SilentlyContinue
214214
}
215+
216+
It 'Should default to _exist=true when not specified explicitly' {
217+
$inputConfig = @{
218+
_metadata = @{
219+
filepath = $TestConfigPath
220+
}
221+
subsystem = @{
222+
name = "testExistDefault"
223+
value = "/path/to/subsystem"
224+
}
225+
} | ConvertTo-Json
226+
227+
$output = sshdconfig set --input $inputConfig -s sshd-config-repeat 2>$null
228+
$LASTEXITCODE | Should -Be 0
229+
# verify subsystem was added (defaulting to _exist=true)
230+
$subsystems = Get-Content $TestConfigPath | Where-Object { $_ -match '^\s*subsystem\s+' }
231+
$subsystems | Should -Contain "subsystem testExistDefault /path/to/subsystem"
232+
}
215233
}
216234
}

0 commit comments

Comments
 (0)