PushCommand tests should push to a mocked endpoint and not Chocolatey Community Repository
Is Your Feature Request Related To A Problem? Please describe.
Currently PushCommand tests require an API Key to push to the Chocolatey Community Repository. This means that community members are not able to run the full test suite as they do not have access to this API Key.
Describe The Solution. Why is it needed?
PowerShell has the ability to respond to HTTP requests. We could therefore have our tests listen for Chocolatey to push a package to it and respond with exactly the message we want.
Additional Context.
NA
Related Issues
NA
Tangentially related to this: the BeforeDiscovery I believe was directly copied from the Licensed Push tests, as such, it contains some variables and checks that are not actually used in here.
https://github.com/chocolatey/choco/blob/345ef4eb9728881400fca31de34858de6839fda6/tests/chocolatey-tests/commands/choco-push.Tests.ps1#L4-L12
@corbob what are your thoughts on this one? Is this still planned/required, or is the work that you have completed recently enough to allow community maintainers to control which endpoint is pushed to?
@corbob still looking for an answer to this?
I think the idea I initially had for this was to mock a CCR response, and then test that both CLI hit the mock endpoint, and that it reported what it was expected to report.
But that might also be much easier said than done. The experimentation I did with PowerShell required a second PowerShell process.
I would be comfortable closing this as there hasn't really been a need for others to run the PushCommand tests in 2 years.
If that is the path that you want to go down, you might be able to use WireMock.Net, in the same way that the Unit/Integration Tests are. It might require a bit more setup when being used outside of that context, but it might still work.