Commit graph

1202 commits

Author SHA1 Message Date
Mark Kraus 19197e11f3 Replace Remaining HttpBin.org Tests with WebListener (#5665)
•Replaces all remaining test that rely on httpbin.org
•Adds Put, Post, Patch, and Delete tests to WebListener by means of routes to Get test and modifications to the Get controller.
•Adds responsephrase option to the Response test to accommodate error message tests
•removed redundant GET tests from irm and iwr tests.
•Fixed markdown linting errors in README.md for WebListener
2017-12-13 19:28:05 +04:00
Travis Plunk 6ef94c1dfe
Make the experience better when start-pspester doesn't find pester (#5673)
refactor code to restore pester into a separate function called Restore-PSPester
update message on what to do when pester is missing
Add ability for get-psoptions to default to new-psoptions
fix an issue with publish-pstesttools when a build has not been run since build.psm1 has been imported (try to use the default options)
make start-pspester use the last build, not just use the default options
fix an issue in restore caused some files not to be removed
2017-12-12 16:07:12 -08:00
Dongbo Wang d966f59a11
Update PowerShell to build with .NET Core runtime 2.0.4 (#5677) 2017-12-12 13:53:22 -08:00
Aditya Patwardhan 0bcc2a2a8f Get GitCommitId using the ProductVersion from Assembly (#5651) 2017-12-08 11:37:29 -08:00
Manikyam Bavandla 15e609caf3 Update 'PowerShellGet' tests to validate the new install location of AllUsers scope. (#5633)
Changed the install location of AllUsers scope on PWSH to SHARED_MODULES location.
2017-12-07 08:59:31 -08:00
Dongbo Wang cc125422dd
Update a flaky test that fails intermittently in CI (#5641) 2017-12-06 12:46:53 -08:00
Mark Kraus ee7fbed23c Make Travis CI use libcurl+openssl+gssapi for macOS (#5629) 2017-12-06 12:20:44 -08:00
James Truher [MSFT] eaeca638fc Run tests for Windows installer only on Windows (#5619) 2017-12-04 14:18:52 -08:00
Dongbo Wang 3469d4b13f [Feature] Supress the expected errors from Select-Xml tests (#5591) 2017-12-04 13:26:53 -08:00
Dongbo Wang c6f27dcb17 [Feature] Make the -SslProtocol tests pending (#5605) 2017-12-04 11:38:30 -08:00
Dongbo Wang d105e15521 Add retry logic to prerequisite URL tests (#5601)
* Disable Requisiste URLs tests

* Add retry for the URL tests
2017-12-04 10:07:30 -08:00
Mark Kraus 95a8a64260 Replace HttpListener Response Tests with WebListener (#5540)
* Add Response Controller

* [Feature] Replace HttpListener Response tests with WebListener
2017-12-04 09:52:14 -08:00
Staffan Gustafsson a9c6292903 Enable conversions from PSMethod to Delegate (#5287)
Underpinnings to make calling of Extension methods /Linq easier from PowerShell.
Enables the following that previously had to be done via reflection.

class M {
  [int] Twice([int] $value) { return 2 * $value }

  [int] DoubleSum([int[]] $values) {
     return [Linq.Enumerable]::Sum($values, [M]::Twice)
  }
}

Each PSMethod is created as with a unique type for the combinations of method signatures in the MethodInfos it represents.

PSMethod<T> where T is a MethodGroup<>, potentially recursive in the last template argument.

This way, we can determine by just looking at the type of a PSMethod if there exists a conversion from the PSMethod to a delegate.
2017-12-01 18:40:35 -08:00
Steve Lee b69ff717ab Remove unncessary check for Paths.count > 0 as there is code later to use the current (#5596)
Remove unnecessary check for Paths.count > 0 as there is code later to use the current working directory since -Path is not a mandatory parameter.
Updated ShouldProcess to output the internal action on adding paths rather than the user action (which is the cmdlet name).

Updated tests to not specify -Path

Fix #5594
2017-12-01 10:57:00 -08:00
Dongbo Wang b5f84c2b39 Skip null-element check for collections with a value-type element type (#5432)
* Fix NotNullOrEmpty check logic

* Fix a test issue on Unix
2017-11-30 14:46:09 -08:00
Chunqing Chen 52df947080 Fix xunnit test for PS (#4780)
* Initial work to enable xunit

* Moved AssemblyOriginatorKeyFile to csharp.tests.csproj

* Native binary has dylib extension on macOS
2017-11-30 14:44:41 -08:00
Steve Lee 7dce4116c7 output url so when test fails you can more easily troubleshoot 2017-11-29 13:00:36 -08:00
Jonathan Muller ad17640d48 Clean up use of 'Runspaceconfiguration' from comments and xunit test code (#5569) 2017-11-29 09:38:04 -08:00
Travis Plunk f67844e4cd Make 'AllSigned' execution policy require modules under $PSHome to be signed (#5511) 2017-11-28 17:34:37 -08:00
Ilya 910c5a4780 Fix PSVersion in PSSessionConfiguration tests (#5554)
* Fix PSVersion in PSSessionConfiguration tests by getting the expected value from PSVersionTable instead of hardcoded string.
2017-11-28 12:00:49 -08:00
Mark Kraus 7778941b40 Fix Import-CliXml Tests (#5521)
Add checks that ProcessName is not null or empty.
2017-11-22 13:34:05 +04:00
Mark Kraus 3ff495dc0b [Feature] Fix AppVeyor Fails (#5520) 2017-11-21 13:09:27 -08:00
Aditya Patwardhan 381134ba59 Updated csproj to use the latest help package (#5454) 2017-11-15 16:29:04 -08:00
Dongbo Wang c4f0d1c893
Add a test for the powershell hang fix (#5451)
- Add test for the powershell hang fix
- Ignore the 'Sync-PSTags' warning
2017-11-15 09:41:11 -08:00
Mark Kraus c832e1687d Add PSTypeName Support for Import-Csv and ConvertFrom-Csv (#5389)
closes #5134

Adds PSTypeName preservation on Import-Csv and ConvertFrom-Csv
2017-11-14 11:15:18 -08:00
Mark Kraus 87bcd4132a Fix Single Value JSON null in Invoke-RestMethod (#5338)
* [Feature] Fix Single Value JSON null in Invoke-WebRequest

* [Feature] Switch from Regex to JToken.Parse()

* [Feature] Address PR Feedback: use `n
2017-11-14 07:53:43 +04:00
Mark Kraus ecf0f8c151 Add SslProtocol Support to WebCmdlets (#5329)
closes #2662

This feature adds the ability to restrict the SSL/TLS protocol used when making the web request. In 5.1 the user could make use of .NET API's to enforce this on the Web Cmdlets. With the move to HttpClient in PowerShell Core, those APIs have no impact. The user still has requirements to ensure specific protocols are used.

The public enum WebSslProtocol is added as a wrapper to the underlying SslProtocols enum. Neither it nor SecurityProtocolType can be used because Ssl3 and Ssl2 are not supported by HttpClientHandler.SslProtocols. While it may not be intuitive to a PowerShell user to use -bor or "Tls, Tls11" to set multiple options, the general use case for this will be a single protocol.

Adds -SslProtocol parameter to Web Cmdlets
Adds WebSslProtocol Enum to support limited subset of SslProtocol enum supported by HttpClientHandler
Adds TLS 1.1 and TLS 1.0 listening ports to WebListener
2017-11-13 10:45:46 -08:00
Ilya c86f243ca0 Make Import-Csv support CR, LF and CRLF as line delimiters (#5363)
With the fix, `Import-Csv` support CR (\r), LF (\n), CRLF (\r\n) as line delimiters.
2017-11-10 14:02:45 -08:00
Chunqing Chen 2be13a623e Disable cmdlets that are not supported under unix system (#5083)
* permanently remove cmdlets that are not supported under Unix and move tests to defaultcommands.tests.ps1
2017-11-10 10:36:08 -08:00
Mark Kraus ee7edb7427 Add error on Legacy Credential over non-HTTPS for Web Cmdlets (#5402)
- Add an error when a user tries to use `-Credential` (legacy usage without `-Authentication`) or `-UseDefaultCredentials` over a non-HTTPS URI
- User can bypass error with `-AllowUnencryptedAuthentication`
- `-UseDefaultCredentials` can only be reliably tested on Windows as support on other platforms depends on a Kerberos infrastructure. 
- Add `/Auth/` tests to WebListener for challenge authentication Basic, Negotiate, and NTLM

Incidentally, this increases test coverage for the web cmdlets as `-Credential` and `-UseDefaultCredentials` were not being tested.
2017-11-10 08:11:57 -08:00
Ilya 5fd1b4759c
Don't write an error if file already unblocked (Unblock-File) (#5362) 2017-11-10 18:14:08 +04:00
Dan Travison 7a78fec180 Exclude EventResource.resx from SMAResources.Tests.ps1 (#5379)
Fix a test failure.
2017-11-09 07:52:01 -08:00
Ilya c4269cb6be Make SemanticVersion compatible with SemVer 2.0 (#5037)
Made 'SemanticVersion' compatible with SymVer 2.0 http://semver.org/ (p.10)
- Fix comparisons
- Refactor and add more tests
2017-11-09 07:44:58 -08:00
Steve Lee 5f5407595d replace the word hang with something more appropriate (#5358) 2017-11-08 13:47:12 -08:00
James Truher [MSFT] fe3e44f305 Change $OutputEncoding to be utf8 without BOM rather than ASCII (#5369) 2017-11-07 14:49:14 -08:00
Jason Shirk 8391b9e155 Rework passing array literal to native commands (#5301) 2017-11-06 17:05:26 -08:00
Keith Hill c781959232 Display full help with 'help' function (#5195)
Display full help with 'help' function
2017-11-06 10:19:39 -08:00
Chunqing Chen 36b600d1ec Add Jobject serialization support to ConvertTo-Json (#5141) 2017-11-03 11:35:09 -07:00
Raphael c9f83fecfc Add Remove-Alias Command (#5143)
* Add Remove-Alias Command. Add Remove-Alias Test. Add Remove-Alias to .psd1.

* Fix code-formatting. Fix ErrorAction on Remove-Alias instead of preference variable. Remove unnecessary Get-Alias calls. Switch Force parameter to auto property. Add ValueFromPipeline to Remove-Alias Name parameter.

* Remove empty lines. Add Remove-Alias to Unix Module .psd1. Add Remove-Alias to approved Commands test. Remove Try/Catch for SessionstateException. Add WriteError for aliasnotfound exception.

* Add ErrorAction Stop to all Get-Alias and Set-Alias Cmdlets in all tests for consistency. Add Should BeNullOrEmpty to "should throw if alias does not exist" test to verify that foo alias really is not there before removing it.

* Changed Remove-Alias parameter Name to String-Array. Changed Cmdlet Process Logic to work with String Array. Added Alias named "ral". Added test case for Alias "ral". Added "ral" Alias to list of approved Aliases. Replaced foo and bar values in all tests with better names.

* Remove "ral"-alias test as this is covered in DefaultCommands.Tests.ps1. Add test for removing multiple alias at once. Fix wrong curly braces positioning.

* Remove $FullCLR in DefaultCommands.Tests.ps1 for Remove-Alias and "ral" alias.

* Add Alias "ral" to Remove-Alias Cmdlet.

* Remove "ral" alias as this is handled by using the [Alias()] attribute on the Remove-Alias Cmdlet.

* Replace alias names used in Remove-Alias Cmdlet tests with GUIDs to avoid collisions
2017-11-03 12:08:37 +04:00
Dongbo Wang 3771c88da3
Always run test with crossgen'ed assemblies in CI (#5315) 2017-11-02 18:03:34 -07:00
Chunqing Chen 2ae776ae1f Fix 'ExecutionContext.LoadAssembly' to load with name when file cannot be found (#5161) 2017-11-02 17:13:02 -07:00
Dongbo Wang a954f9f98c
Change line ending in Rename-Computer.Tests.ps1 to LF (#5314) 2017-11-02 14:17:45 -07:00
Dongbo Wang decdd1a828 Update powershell to use 2.0.4-servicing dotnet core runtime (#5295) 2017-11-02 14:12:19 -07:00
Jason Shirk 71d5439bbe
Fix dynamic class assembly name (#5292)
Using the assembly name to hint at the source of the classes was
problematic in multiple ways.

This change stores the actual filename in an attribute on the assembly.

So for a given type, one can get the assembly this way:

[SomeType].Assembly.GetCustomAttributes() |
    ? { $_ -is [System.Management.Automation.DynamicClassImplementationAssemblyAttribute] } |
    % { $_.ScriptFile }
2017-11-02 10:29:10 -07:00
Dongbo Wang 532044f27a
Add documentation about how to create libpsl and psrp.windows packages (#5278)
- Add document about creating libpsl and psrp.windows nuget packages
- Clean up and update the existing building docs.
2017-11-01 15:55:46 -07:00
Mark Kraus 57f3c85469 Add Multiple Link Header Support (#5265) 2017-11-01 14:06:30 -07:00
James Truher [MSFT] d43b2cf958 Remove DCOM support from *-Computer cmdlets (#5277)
Since DCOM is not supported in corefx there was a great deal of dead code in the computer cmdlets.
This PR removes all vestiges of DCOM support from:

- Rename-Computer
- Restart-Computer
- Stop-Computer

removing about 4500 lines of dead code. Also, tests are updated to provide more complete coverage.
I also removed test-connection completely to make way for @iSazonov upcoming PR to improve coverage in tests, I created some test hook code which will test the cmdlet code without actually calling the WMI method to restart/rename/stop the system
2017-11-01 10:59:41 -07:00
Jason Shirk 6cbcf5dd3e Glob native command args only when not quoted
Also fix some minor issues with exceptions being raised when resolving
the path - falling back to no glob.

Fix: #3931 #4971
2017-10-31 23:34:50 -07:00
Dongbo Wang 73c6a73752 Fix line endings with LF (#5288) 2017-10-31 16:31:41 -07:00
James Truher [MSFT] 63f55427ec fix sparse-checkout list (#5263)
* fix sparse-checkout list
* Run powershell.exe in OpenCover since it will be in the path.
* If there's an error in Start-CodeCoverageRun be sure to log as much as possible
* Make the directory removal code common
2017-10-31 15:40:23 -07:00