Fix early filter invalid symbols during register
This commit is contained in:
parent
dbbeb0c31f
commit
e99237d8b3
3 changed files with 10 additions and 6 deletions
|
@ -76,7 +76,7 @@ class RegisterRepository(
|
|||
Single.just(Jsoup.parse(cert.wresult.replace(":", ""), "", Parser.xmlParser())
|
||||
.select("[AttributeName$=\"Instance\"] samlAttributeValue")
|
||||
.map { it.text().trim() }
|
||||
.filter { it.matches("[a-zA-Z]*".toRegex()) } // early filter invalid symbols
|
||||
.filter { it.matches("[a-z0-9]*".toRegex()) } // early filter invalid symbols
|
||||
.ifEmpty { listOf("opole", "gdansk", "tarnow", "rzeszow") } // fallback
|
||||
.map { Pair(it, cert) }
|
||||
)
|
||||
|
|
|
@ -15,6 +15,7 @@ import io.github.wulkanowy.api.service.StudentService
|
|||
import io.reactivex.observers.TestObserver
|
||||
import okhttp3.mockwebserver.MockResponse
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import java.net.CookieManager
|
||||
|
||||
|
@ -144,11 +145,14 @@ class RegisterRepositoryTest : BaseLocalTest() {
|
|||
|
||||
server.start(3000)
|
||||
|
||||
val res = getRegisterRepository(" glubczyce2").getStudents()
|
||||
val res = getRegisterRepository("Default").getStudents()
|
||||
val observer = TestObserver<List<Student>>()
|
||||
res.subscribe(observer)
|
||||
observer.assertTerminated()
|
||||
|
||||
assertEquals("/glubczyce2/Account/LogOn", server.takeRequest().path)
|
||||
assertEquals("/Default/Account/LogOn", server.takeRequest().path)
|
||||
assertTrue(server.takeRequest().path.startsWith("/Account/LogOn?ReturnUrl=%2FDefault"))
|
||||
assertEquals("/default/LoginEndpoint.aspx", server.takeRequest().path)
|
||||
assertEquals("/glubczyce2/LoginEndpoint.aspx", server.takeRequest().path)
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue