Refactor NuGet integration tests to use mocked HTTP responses #521
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Integration tests were reaching out to live NuGet APIs, causing spurious CI failures and introducing security risk from untrusted external resources.
Changes
IHttpClientFactorywith NSubstituteResources.resxPyPI test data path (build blocker)Example
Before:
After:
All 7 tests pass without external dependencies. Tests validate manager type selection logic (V2 vs V3) based on repository URL qualifiers.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/angular/angular/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 33417 --endpoint 127.0.0.1:033417 --role client --parentprocessid 5626 --telemetryoptedin false(http block)https://api.github.com/repos/lodash/lodash/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 33417 --endpoint 127.0.0.1:033417 --role client --parentprocessid 5626 --telemetryoptedin false(http block)https://api.github.com/repos/npm/security-holder/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 33417 --endpoint 127.0.0.1:033417 --role client --parentprocessid 5626 --telemetryoptedin false(http block)https://api.github.com/repos/pandas-dev/pandas/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 33417 --endpoint 127.0.0.1:033417 --role client --parentprocessid 5626 --telemetryoptedin false(http block)https://api.github.com/repos/plotly/plotly.py/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 33417 --endpoint 127.0.0.1:033417 --role client --parentprocessid 5626 --telemetryoptedin false(http block)https://api.github.com/repos/psf/requests/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 33417 --endpoint 127.0.0.1:033417 --role client --parentprocessid 5626 --telemetryoptedin false(http block)www.nuget.org/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 36069 --endpoint 127.0.0.1:036069 --role client --parentprocessid 3974 --telemetryoptedin false(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 38643 --endpoint 127.0.0.1:038643 --role client --parentprocessid 4206 --telemetryoptedin false(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 37163 --endpoint 127.0.0.1:037163 --role client --parentprocessid 4953 --telemetryoptedin false(dns block)www.powershellgallery.com/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 36069 --endpoint 127.0.0.1:036069 --role client --parentprocessid 3974 --telemetryoptedin false(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 38643 --endpoint 127.0.0.1:038643 --role client --parentprocessid 4206 --telemetryoptedin false(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.runtimeconfig.json --depsfile /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/oss-tests.deps.json /home/REDACTED/work/OSSGadget/OSSGadget/src/oss-tests/bin/Debug/net8.0/testhost.dll --port 37163 --endpoint 127.0.0.1:037163 --role client --parentprocessid 4953 --telemetryoptedin false(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.