|
1 | 1 | package app.softnetwork.account.scalatest |
2 | 2 |
|
3 | | -import akka.http.scaladsl.model.{FormData, HttpProtocols, StatusCodes} |
| 3 | +import akka.http.scaladsl.model.{FormData, HttpEntity, HttpProtocols, HttpResponse, StatusCodes} |
4 | 4 | import akka.http.scaladsl.model.headers.{BasicHttpCredentials, OAuth2BearerToken} |
| 5 | +import akka.http.scaladsl.unmarshalling.Unmarshaller |
5 | 6 | import app.softnetwork.account.config.AccountSettings |
6 | 7 | import app.softnetwork.account.handlers.{AccountKeyDao, MockGenerator} |
7 | 8 | import app.softnetwork.account.message._ |
@@ -245,9 +246,15 @@ trait AccountRouteSpec[ |
245 | 246 | OAuth2BearerToken(accessToken) |
246 | 247 | ) ~> routes ~> check { |
247 | 248 | status shouldEqual StatusCodes.OK |
248 | | - val me = responseAs[Me] |
249 | | - me.firstName shouldBe firstName |
250 | | - me.lastName shouldBe lastName |
| 249 | + implicit val responseBodyUnmarshaller: Unmarshaller[HttpResponse, String] = |
| 250 | + Unmarshaller |
| 251 | + .strict[HttpResponse, HttpEntity](_.entity) |
| 252 | + .andThen(Unmarshaller.stringUnmarshaller) |
| 253 | + val str = responseAs[String] |
| 254 | + log.info(str) |
| 255 | + val me = serialization.read[Me](str) |
| 256 | + assert(me.firstName == firstName) |
| 257 | + assert(me.lastName == lastName) |
251 | 258 | } |
252 | 259 | } |
253 | 260 | "signin using OAuth2" in { |
|
0 commit comments