TestingFramework
TestingFramework copied to clipboard
Mocking an HTTP Request to an External API not mocking
We have run into an issue where we are unable to mock an HTTP request to an external API. No matter how we build the Mock, we receive live data back from the system.
In larger tests we have been able to mock request to local function app actions, but are unable to mock requests to an external API using the HTTP action.
I have attached the workflow.json, test class & project file, the parameters.json and the testConfiguration.json file.
HttpTriggerTests2.cs.txt parameters.json testConfiguration.json Tests.csproj.txt workflow.json
Hi @ShaneLucykHCS , sorry about the delay in looking at this.
I've looked at the code that you uploaded. Are you saying that you can't get the framework to use this mock:
Or are you having trouble matching when you uncomment the four lines that match using the Path, Query parameters and HTTP headers?
Hi @ShaneLucykHCS , sorry about the delay in looking at this.
I've looked at the code that you uploaded. Are you saying that you can't get the framework to use this mock:
Or are you having trouble matching when you uncomment the four lines that match using the Path, Query parameters and HTTP headers?
I can't get the framework to use that mock. Or any mock against a node that makes a request against a REST API. It always makes the live request. Those commented-out lines are various attempts at matching on something other than the path in case it was a matching issue.
