32 lines
1.1 KiB
PowerShell
32 lines
1.1 KiB
PowerShell
$repositoryRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
|
$localUserScriptPath = Join-Path $repositoryRoot 'scripts\Set-SguStandardLocalUser.ps1'
|
|
|
|
$tokens = $null
|
|
$parseErrors = $null
|
|
$scriptAst = [Management.Automation.Language.Parser]::ParseFile(
|
|
$localUserScriptPath,
|
|
[ref]$tokens,
|
|
[ref]$parseErrors)
|
|
if ($parseErrors.Count -gt 0) {
|
|
throw ($parseErrors -join [Environment]::NewLine)
|
|
}
|
|
|
|
$descriptionAssignment = $scriptAst.Find({
|
|
param($node)
|
|
$node -is [Management.Automation.Language.AssignmentStatementAst] -and
|
|
$node.Left.Extent.Text -eq '$description'
|
|
}, $true)
|
|
$description = $descriptionAssignment.Right.Extent.Text.Trim("'")
|
|
|
|
Describe 'SGU Windows client enrollment scripts' {
|
|
It 'keeps the local-user description within the Windows 10 limit' {
|
|
($description.Length -le 48) | Should Be $true
|
|
}
|
|
|
|
It 'declares the managed local student account' {
|
|
$source = Get-Content -LiteralPath $localUserScriptPath -Raw
|
|
$source | Should Match "\$userName = 'alumno'"
|
|
$source | Should Match "\$plainTextPassword = 'ingenieria'"
|
|
}
|
|
}
|