Rahul
Rahul

Reputation: 1807

Mock Session in Spring Boot and RestAssured

I have a web application, running with Spring Boot. Now I have to write tests with Rest Assured. However, for running some of them I have to be authenticated on the server. Server uses google oauth authentication. Is there any way to mock session with rest assured? Documentation doesn't say a lot about this and ways covered there don't help.

when()
      .sessionId("id here")

On the server side I'm using HttpSession with userId parameter inside.

Upvotes: 1

Views: 722

Answers (1)

Rahul
Rahul

Reputation: 1807

I have found a solution. RestAssured (since 3.0.0) has integration with MockMvc and session mocking could be reached through calling something like

given().sessionAttr("name", value)

Upvotes: 2

Related Questions