Last active
March 10, 2020 17:16
-
-
Save zachlayman-applitools/861d8535cfec708c7e4d53e0e0d2f5c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add-type @" | |
using System.Net; | |
using System.Security.Cryptography.X509Certificates; | |
public class TrustAllCertsPolicy : ICertificatePolicy { | |
public bool CheckValidationResult( | |
ServicePoint srvPoint, X509Certificate certificate, | |
WebRequest request, int certificateProblem) { | |
return true; | |
} | |
} | |
"@ | |
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12' | |
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols | |
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy | |
$server_url = $args[0] | |
$api_key = $args[1] | |
$date_str = Get-Date -Format "yyMMddhhmmss" | |
$date_header = Get-Date -Format "ddd, dd MMM yyyy hh:mm:ss zzz" | |
$results_table = curl -Method Get https://$server_url.applitools.com/api/sessions/renderinfo?apiKey=$api_key | ConvertFrom-Json | |
$put_url = $results_table.resultsUrl.Replace("__random__", $date_str) | |
Write-Host "Testing PUT to:" | |
Write-Host $put_url | |
$put_results = curl -Method Put -Body "" -Headers @{'x-ms-date' = "$date_header"; 'x-ms-blob-type' = 'BlockBlob';'x-ms-version' = '2015-02-21'} "$put_url" | |
Write-Host $put_results.StatusCode $put_results.StatusDescription |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g. .\windows.ps1 “mycompanyeyes" “APPLITOOLS_API_KEY"
e.g. Testing PUT to: https://mycompanyeyes.blob.core.windows.net/temp/blabla?sv=xxxxxxx&sr=xxx&sig=xxxxxxxx&se=xxxxx&sp=xx&accessKey=xxxxxx
means you need to whitelist mycompanyeyes.blob.core.windows.net