Treat the unexpected error on homepage endpoints as not logged in
This commit is contained in:
parent
e0e12226ab
commit
d95867e200
2 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,12 @@ class NotLoggedInErrorInterceptor(private val loginType: Api.LoginType) : Interc
|
||||||
val response = chain.proceed(chain.request())
|
val response = chain.proceed(chain.request())
|
||||||
val doc = Jsoup.parse(response.peekBody(Long.MAX_VALUE).string())
|
val doc = Jsoup.parse(response.peekBody(Long.MAX_VALUE).string())
|
||||||
|
|
||||||
|
if (chain.request().url().toString().contains("/Start.mvc/")) {
|
||||||
|
doc.select(".errorBlock").let {
|
||||||
|
if (it.isNotEmpty()) throw NotLoggedInException("${it.select(".errorTitle").text()}}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (when (loginType) {
|
if (when (loginType) {
|
||||||
Api.LoginType.STANDARD -> doc.select(".loginButton, .LogOnBoard input[type=submit]")
|
Api.LoginType.STANDARD -> doc.select(".loginButton, .LogOnBoard input[type=submit]")
|
||||||
Api.LoginType.ADFS -> doc.select("form[name=form1] #SubmitButton")
|
Api.LoginType.ADFS -> doc.select("form[name=form1] #SubmitButton")
|
||||||
|
|
|
@ -530,4 +530,10 @@ class ApiRemoteTest : BaseTest() {
|
||||||
//
|
//
|
||||||
// assertTrue(luckyNumberObserver.values().size == 0 || luckyNumberObserver.values()[0] != 0)
|
// assertTrue(luckyNumberObserver.values().size == 0 || luckyNumberObserver.values()[0] != 0)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun freeDays() {
|
||||||
|
val freeDays = api.getFreeDays().blockingGet()
|
||||||
|
assertEquals(1, freeDays.size)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue