Commit graph

1032 commits

Author SHA1 Message Date
Mark Kraus f41461825a Replace httpbin.org/get tests With WebListener (#4738)
* Adds the /Get/ functionality to Weblistener
* Replaces the tests that rely on httpbin.org/get with WebListener


* [Feature] Move HttpBin/Get Tests to WebListener

* [Feature] update .spelling

* [Feature] Address PR Feedback

* [Feature] Add and document Home & /

* Readme Update

* [Feature] Should Match -> Should Be

Rerun CI

* [Feature] Rebase and Rerun CI
2017-09-08 07:53:04 +04:00
Ilya 3c597367ba Replace 'Windows PowerShell' with 'PowerShell' in resx files (#4758)
Replace 'Windows PowerShell' with 'PowerShell' in '.resx' files where appropriate.
2017-09-07 12:33:56 -07:00
Steve Lee 7c9b188c13 Rename $IsOSX to $IsMacOS (#4757) 2017-09-07 10:34:40 -07:00
James Truher [MSFT] ee0bb15b71 Make it easier to view and compare code coverage for a file (#4764) 2017-09-06 17:11:50 -07:00
Dan Travison 7faf76b9c9 Disable test "Test 01. Standard Property test - all properties (<property>)" due to missing CsPhysicallyInstalledMemory (#4763) 2017-09-06 15:14:40 -07:00
Dongbo Wang 41f12b1d2c Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets (#4709)
When dotting a script cmdlet, the locals of automatic variables from the `PSScriptCmdlet` is not set up in the current scope before parameter binding. The fix is to push the locals in `CommandProcessor.OnSetCurrentScope` and pop them in `CommandProcessor.OnRestorePreviousScope`, which will be called from `SetCurrentScopeToExecutionScope` and `RestorePreviousScope` respectively.

Summary of changes:
1. When a new local scope is used, currently we set the locals for `CommandProcessor` right before parameter binding (in `BindCommandLineParametersNoValidation`); we set the locals for `ScriptCommandProcessor` in `Prepare`. I moved both to the constructor, right after the new scope is created so that the code is more consistent.

2. In `CmdletParameterBinderController.cs`, we set up the `PSBoundParameters` and `MyInvocation` variables in `HandleCommandLineDynamicParameters` again, which I think is unnecessary because this method is only called from `BindCommandLineParametersNoValidation`, where the setup is done for the first time.

3. Currently, the locals will be set for dotted script cmdlet in `EnterScope()` and `ExitScope()`. Now, that logic is moved to `OnSetCurrentScope` and `OnRestorePreviousScope` of `CommandProcessor`. This not only makes sure that locals are set before parameter binding, but also is consistent with the `ScriptCommandProcessor`.
2017-09-06 10:25:33 -07:00
James Truher [MSFT] 5d0a1c1a7f get tests to display the same number of tests regardless of platform (#4728)
* Make count of tests the same between Windows and Non-Windows platforms

Change logic so test cases are created for all platforms, but only load the helper module on windows

* Ensure Get-ComputerInfo tests run the same number of tests regardless of platform
2017-09-05 11:17:57 -07:00
Steve Lee fb286e6cf8 Removed double spaces from .cs and .ps1 files (#4743) 2017-09-04 19:45:51 -07:00
Steve Lee efa320cdf8 Update docs about the pull-request-process (#4710)
Update pull-request-process to clarify role/responsibility of author and reviewers based on recent feedback from team and community. Also moved it to `.github/CONTRIBUTING.md` so that all related information can be found at one place.
2017-09-04 10:29:20 -07:00
Ilya fb67072479 Fix error message in ValidateSetAttribute ValidateElement() (#4722) 2017-09-04 09:11:47 -07:00
Michael Klement 803395b959 Fix for Get-Content -Delimiter including the delimiter in the array elements returned (#3706) - formatting changes 2017-09-01 13:01:43 -07:00
Michael Klement 1de749fbaa Fix for Get-Content -Delimiter including the delimiter in the array elements returned (#3706) - functional changes 2017-09-01 13:01:43 -07:00
Chunqing Chen 87e1d55f45 Set Redist test pending to unblock daily build failure (#4729) 2017-09-01 11:53:17 -07:00
Ilya 58a296ed49 Ensure GetNetworkCredential() returns null if PSCredential has null or empty user name (#4697)
* GetNetworkCredential() returns null if PSCredential has empty user name

* Fix test
2017-09-01 11:50:15 -07:00
Mark Kraus 87db370a59 Move WebCmdlets HTTPS tests to WebListener (#4733)
* Move HTTPS tests to WebListener

* Move Invoke-WebRequest HTTPS Tests to Context

* [Feature] Move Invoke-RestMethod HTTPS Tests to Context

.

* [feature] Address PR Feedback

* [feature] Mark Cert Auth Tests Pending

-skip -> -pending
2017-09-01 22:31:15 +04:00
Andrew deaa7c9375 Trace-Command tests for code coverage (#4288)
Added tests for Trace-Command that increase code coverage to 80%~85% per class.
2017-09-01 09:08:17 -07:00
Dongbo Wang 795de73d31 Fix 'using module' when module has non-terminating errors handled with 'SilentlyContinue' (#4711)
`Compiler.LoadModule` assumes that when `ps.HadErrors == true` the error stream is not empty. However, when `SilentlyContinue` is specified as the error action, the non-terminating error is not kept in `ErrorOutputPipe` of the cmdlet and thus does not appear in `ps.Streams.Error`. So when `ps.HadErrors == true` while `ps.Streams.Error` is empty, it suggests it's OK to ignore the errors because they are explicitly suppressed with `SilentlyContinue` error action.

So in my opinion, the expected behavior of `"using module .\mod.psm1"` in this case should be successful as if `ps.HaddErrors` is false.
2017-09-01 08:54:08 -07:00
James Truher [MSFT] e0b7c23384 Report the same number of tests when run by Travis via cron (#4731) 2017-08-31 15:03:20 -07:00
Dan Travison 96a90f8985 Add explicit ContentType detection to Invoke-RestMethod (#4692)
This change removes the call to `ContentHelper.GetEncoding` since it's logic for returning a default encoding when a ContentType header is not found disables subsequent checks for meta charset definitions.
All variations of the Invoke-WebRequest tests have been mirrored for Invoke-RestMethod. Verbose output is used to verify the encoding since Invoke-RestMethod returns the JSON content directly instead of a response object. (See ExecuteRestMethod)
2017-08-31 10:47:54 -07:00
Mark Kraus 3b2d169c5e Add test WebListener module and tests for Web Cmdlet Certificate Authentication (#4622)
Introduce new test module 'WebListener.psm1'.
Now web HTTPS tests can use it to exclude using external sites.

PowerShell/PowerShell#4609

* [Feature] Add Tests for Web Cmdlet Certificate Authentication

PowerShell/PowerShell#4609

* [feature] Add new app to Publish-PSTestTools refactor tests

also add ASP.NET to .spelling

* [feature] spelling fix

* [feature] revert badssl changes

* [feature] Impliment suggestions

* [feature] Spelling, var rename, port 8443 to 8083

rebase fix conflict

* [feature] Rename to HttpsListener and Module-ize

.

* [feature] password protect ClientCert to fix macOS import issue

* [feature] Rename to WebListener 

* Rename HttpsListener to WebListener
* Switch Listener from Razor pages to MVC
* Address PR feedback
* Adjust tests

* [feature] Address PR feedback

* [feature] Replace missing smeicolons

* [feature] Address PR Feedback

* [feature] Cleanup and minor fix

* Enum was not used
* GetStatus() was not accessing the correct property chain
* Added -Test param to make URL generation smoother in test code and to fix double / issues

* [feature] More minor fixes

* Https when it matters.
* Expand property... not exclude..
* Remove superfluous and outdated ToString() override

* [Feature] Move ClientCeret.pfx to WebListener Module

* Move the cert
* Adjust Get-WebListenerClientCertificate 
* Remove cert from csproj
* ActionResult -> JsonResult (was mistakenly left as ActionResult during testing)..

* [Feature] Move ServerCert.pfx to Module

* Move cert
* Upate csproj
* Update module
* Add/Update README.md's

CI Retest.
2017-08-31 13:30:35 +04:00
Steve Lee deb8c4485d Remove alternate file stream code from non-Windows (#4567)
* AlternateStreams support relies on pinvoke to win32 APIs which don't work on non-Windows and produces errors about not loading a DLL in the case of copy-item
* Address PR feedback, remove -Stream parameter for Unix added new -stream tests
* if/def out alternate stream syntax checks not applicable to Unix
2017-08-28 15:39:42 -07:00
Chunqing Chen fe51fb7f60 Make 'Test-ModuleManifest' not load unnecessary modules (#4541) 2017-08-28 15:36:46 -07:00
Dongbo Wang 12002e7f2d Use stricter rule to unwrap a PSObject that wraps a COM object (#4614)
GetMember/SetMember/InvokeMember operations on a COM object will generate code to unwrap the COM object if it's wrapped in PSObject. Due to a loose restriction, if you have a string wrapped to a PSObject with an ETS member of the same name, then the string PSObject will be unwrapped too and the ETS member will be lost. The fix is to use a more restricted rule by checking if the base object is a COM object.
2017-08-28 13:19:02 -07:00
Mike Richmond c21906667f Disable 'VC++ Redist' test and run 'Windows Installer' test only on Windows (#4673) 2017-08-25 13:36:13 -07:00
Steve Lee 1e0acfac5e removed appending WindowsPowerShell PSModulePath (#4656) 2017-08-25 11:05:23 -07:00
Mark Kraus 5941b894ab Mark Multiple Response Header Test Pending (#4640) 2017-08-22 14:27:47 -07:00
Mark Kraus 297bba3fa1 Add support for Content Headers to BasicHtmlWebResponseObject and HtmlWebResponseObject (#4494) 2017-08-21 10:48:25 -07:00
Mark Kraus 1b23a62ae1 [Feature] Add Certificate Authentication Support for WebCmdlets (#4546)
* [Feature] Add Certificate Authentication Support for WebCmdlets

PowerShell/PowerShell#4544

* Add Certificate  Comments

* Set Certificate Options

* [feature] Post-rebase White-space correction

* [feature] mark certauth tests pending
2017-08-18 13:56:31 -07:00
bergmeister 54e892ab06 Make MSI installer perform pre-requisite checks (#4602)
* #4458 MSI installer checks that the Windows C Runtime and VS Studio 2015 C++ redistributables are present and returns error message if not.
Includes tests to check that the Wix file contains the download URLs and those URLs are not dead.
2017-08-18 12:47:43 -07:00
James Truher [MSFT] f6208f3c42 Add File Coverage to coverage data (#4556)
It is now possible to see the coverage based on the file and then format
the data so a report generator is not needed. You can map the files from
one location to another, so if you have a copy of the repo, but in a different
location, you can still format the output in a way so it may be studied
2017-08-17 13:39:23 -07:00
Dongbo Wang befc5f8ae1 Make PowerShell Core enumerate COM collections (#4553)
Make PowerShell Core enumerate COM collections
2017-08-17 20:23:36 +04:00
Ilya 45d1d20500 Merge pull request #4573 from SteveL-MSFT/console-no
* Make invalid arg to -File consistent with -Command
Improve error message if ambiguous arg is passed to -File

* Update powershell console exit codes to match Unix standards

* Enable -WindowStyle to work
2017-08-17 07:34:02 +04:00
Dongbo Wang b3e7fd374f Move to the official .NET Core 2.0 (#4603)
* Migrate to official .NET Core 2.0

* [Feature] Remove chmod code as the issue has been fixed in dotnet
2017-08-16 17:32:46 -07:00
James Truher [MSFT] 0d1e1919f2 Improve test coverage for CDXML cmdlet infrastructure (#4537)
Create custom CIM classes (via MOF) and CDXML cmdlets against the new CIM class
Create tests for CRUD operations for CDXML cmdlets
Coverage for Microsoft.PowerShell.Cmdletization namespace is nearly 50%
2017-08-16 16:33:53 -07:00
Dan Travison 75a294993c In Web CmdLets, Use HTML meta charset attribute value, if present (#4338)
* Use HTML meta charset attribute value, if present, when the Context-Type header does not specify it.
2017-08-16 16:25:16 -07:00
Maria Romero ea77b57966 Update Format-Hex tests to include -TestCase parameter (#3800)
* update tests to include -TestCase paramater in It block

* Move test functions to appropriate context blocks

* combine skipTest conditions

* move skipTest to Describe block

* correct typo, change to MatchExactly
2017-08-16 15:50:33 -07:00
Steve Lee [MSFT] 26f7db720c Enable -WindowStyle to work 2017-08-16 15:04:34 -07:00
Steve Lee [MSFT] 4c22b10a38 Update powershell console exit codes to match Unix standards 2017-08-16 15:04:03 -07:00
Steve Lee feed7004c7 added tests for primitive types, dictionary type, and enumerable type for convertto-xml (#4503)
* added tests for primitive types, dictionary type, and enumerable type

* address PR feedback
2017-08-16 12:13:07 -07:00
Dongbo Wang feeb8e1d25 [Feature] Clean up FullCLR related scripts/docs (#4580) 2017-08-16 12:07:45 -07:00
Kirk Munro 02c4d34380 Add support for converting enums as strings in JSON (#4318)
* converting enums as strings support

* removed !CORECLR code per @SteveL-MSFT's request
2017-08-16 09:57:30 -07:00
Dongbo Wang a648d4dd9c Add more tab completion tests (#4560)
* Add tab completion tests for CompletionAnalysis.cs

* Minor fixes

* Address comment

* Address one more comment
2017-08-15 09:49:48 -07:00
Aditya Patwardhan b953ab126d Opencover and Code coverage improvements (#4550) 2017-08-14 10:40:11 -07:00
Steve Lee 7b8c6e7f54 fix intermittent failures in filesystem tests (#4566) 2017-08-14 08:53:04 -07:00
Ilya 813e4a661a Fix unblock read only file (#4395)
Adds a new non-terminating error when a file is read-only
2017-08-14 08:49:38 -07:00
Dongbo Wang e83fcca277 Reorganize some engine tests to make it clean (#4551)
1. The individual test files (.ps1) in `/test/powershell/engine` are moved to the corresponding subfolders.
2. The test asset file `test/powershell/Common/TestTypeFile.ps1xml` is moved to `test/powershell/Common/engine/Api/assets/` so that it's next to the test that is using the file.
2017-08-14 13:49:28 +04:00
Manikyam Bavandla 0bfee35525 Add an additional acceptance test for the PowerShellGet module (#4531)
* Add an additional acceptance test for the PowerShellGet module

* Removed 'BVT' tag
2017-08-10 13:33:25 -07:00
Dongbo Wang 384a9fe3fc Clean up ShellExecute code to use the .NET Core implementation (#4523)
* Clean up ShellExecuteHelper and enable ShellExecute in NativeCommandProcessor

* Minor fix

* [Feature] Fix NativeCommandProcessor to clean up in case an exception is thron

* [Feature] Update tests

* [Feature] Address comments

* address one more comment

* Address some more comments
2017-08-10 13:32:57 -07:00
Dongbo Wang 7762d7bf49 clean up map.json related files and scripts (#4532)
* clean up map.json related files and scripts

* Update .spelling
2017-08-10 13:32:19 -07:00
Steve Lee eea3885242 Enable WSManCredSSP cmdlets (#4336)
* [Feature]
Fixed error message using a null resourcemanager
With most recent CoreFx supporting STA, removed special CoreClr code paths
Added test coverage
Removed some dead commented out code that was never used

* [Feature]
merged tests to one file, use runas to have relevant tests run as non-elevated

* [Feature]
Get-CredSSP returns text so only run that test if current culture is en-US

* [Feature] Update test to fix code exclusion

* [Feature] Fix Skipping on test cases that already had a Skip value
2017-08-10 13:31:54 -07:00