Questions tagged [http-mock]
22 questions
0
votes
1 answer
When using httpmock in Rust, can one mock server handle multiple paths?
I'm testing the engine's register and poll(health check at regular intervals) behavior by making a mock server that replaces the admin server.
let admin_mock_server = admin_server.mock(|when, then| {
when.path("/register")
…

yjlee
- 363
- 1
- 14
0
votes
2 answers
Error in Jest test req.session.save is not a function
It giving me a error at await req.session.save(); like req.session.save is not a function.
How I can create mock for req.session.save()?
myController.ts
static async connect(req: any, res: Response) {
...
req.session.testToken = {
…

Shivam Sharma
- 9
- 4
0
votes
1 answer
Unable to mock a users access token from the request object and test the method
I am trying to unit test a method that creates a JWT and in the process I am trying to mock out the user's access token that would be used to create the JWT. Here is my method and the test:
returnToken(expressRequestObject) {
const payload =…

boomchickawawa
- 508
- 1
- 6
- 25
0
votes
1 answer
HttpMock is not intercepting Resty call
I have a function that calls an external api that I want to mock out in the test.
func ApiWrapper(...) (...) {
client := resty.New()
var r apiResponse
apiPath := "..." // In the test will be http://localhost:{PORT}/path/to/endpoint
_, e :=…

Dan
- 1,874
- 1
- 16
- 21
0
votes
1 answer
HttpMediaTypeNotAcceptableException when calling REST API using mockMVC
I am trying to test my API,for which I am calling my API using mockMVC as below:
ResultActions resultAction = mockMvc.perform(MockMvcRequestBuilders.get("/users/v1/{userId}",userId)
…

javaguy
- 927
- 2
- 16
- 37
0
votes
2 answers
How to stop Ember CLI's http-mock server throwing an error when there are websockets in one of the server files?
I have a websocket in one of my http-mock server files initialised as follows:
var WebSocketServer = require('ws').Server;
var socketServer = new WebSocketServer({port: 13434, path: "/update"});
and later in the file I have the following happen on…

KroneckerDeIta
- 49
- 9
-1
votes
1 answer
Register mock service URL
In the hero.service.ts file for Angular's quick start example, step 7, is this snippet of code:
@Injectable()
export class HeroService {
private headers = new Headers({'Content-Type': 'application/json'});
private heroesUrl = 'api/heroes'; //…

Mike Henderson
- 2,028
- 1
- 13
- 32