I am trying to write some integration tests. What I want to achieve is to setup a couple of fake URLs to emulate third party services. I want to know if it is possible to set dynamically URL path for test. For example I have this code
In a base file for the test I have this
override lazy val port = 1234
val myappTestConf = Map (
"app.twilio.lookups" -> s"https://localhost:$port",
)
override lazy val port = 1234
implicit override lazy val app: FakeApplication =
FakeApplication(
additionalConfiguration = myappTestConf
)
and then in a more specific file I have this
val getLookupPhoneUrl = s"${phoneNumber}"
implicit override lazy val app: FakeApplication =
FakeApplication(
additionalConfiguration = myappTestConf,
withRoutes = {
case ("GET", `getLookupPhoneUrl`) => Action(testLookupPhone(_))
}
)
The problem that I have is that this code does not compile because in the second file the phoneNumber has not been setted up, but I would like to set up dinamically, is that possible?
Thank you