-
Notifications
You must be signed in to change notification settings - Fork 5
/
Tests.ps1
26 lines (18 loc) · 1.05 KB
/
Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$here = (Split-Path -parent $MyInvocation.MyCommand.Definition)
import-module -name ($here + "\PsUrl\PsUrl.psm1") -force
write-host Should support downloading stuff
get-webcontent "http://example.com" | out-null
write-host Should support downloading encoded stuff
get-webcontent "http://example.com" -Encoding ([Text.Encoding]::Utf8) | out-null
write-host Should support downloading encoded stuff 2
get-webcontent "http://example.com" -Encoding utf-8 | out-null
write-host Should support 404
get-webcontent "http://us.blizzard.com/en-us/404/" -ErrorAction:SilentlyContinue
write-host Should support downloading to file
get-url "http://example.com" -ToFile "$here\example.html"
if (-not (test-path "$here\example.html")){ write-error "example.html was not downloaded" }
remove-item "$here\example.html"
write-host Should support posting stuff
send-webcontent "http://example.com" -Data @{"Foo" = "Bar"} | out-null
write-host Should support posting stuff with headers
send-webcontent "http://example.com" -Data @{"Foo" = "Bar"} -Headers @{"Something" = "Funny"} | out-null