implement new Download-FileDirectly function to handle downloads

This commit is contained in:
2026-09-30 11:42:05 -04:00
parent 4e06ede640
commit 0975f5d24a
5 changed files with 79 additions and 31 deletions
+3 -1
View File
@@ -9,7 +9,8 @@ $null = [Management.Automation.Language.Parser]::ParseFile($DsaScriptUnderTest,
If ($DsaErrors.Count) { Throw ($DsaErrors | Out-String) }
Function Assert-Dsa { param([bool]$Condition, [string]$Description) If (!$Condition) { Throw $Description } }
Function Download-File {
Function Download-File { Throw 'DSA must use Download-FileDirectly.' }
Function Download-FileDirectly {
[CmdletBinding()]
param($URL, $File)
$script:DsaDownloadCalls++
@@ -80,6 +81,7 @@ Function Invoke-DsaCase {
Assert-Dsa ($script:DsaDownloadCalls -eq 0) 'Invalid flag must fail before downloading.'
Return
}
Assert-Dsa ($script:DsaDownloadCalls -eq 1) 'Expected one direct download.'
If ($Mode -in @('empty-download','download-failure')) {
Assert-Dsa ($null -ne $DsaCaught) 'Download failure must stop collection.'
Assert-Dsa ($script:DsaProcessCalls -eq 0 -and $script:DsaRecordedUploads.Count -eq 0) 'Download failure must prevent execution and upload.'