diff --git a/src/main/kotlin/io/github/wulkanowy/api/repository/RegisterRepository.kt b/src/main/kotlin/io/github/wulkanowy/api/repository/RegisterRepository.kt index bf348572..48253918 100644 --- a/src/main/kotlin/io/github/wulkanowy/api/repository/RegisterRepository.kt +++ b/src/main/kotlin/io/github/wulkanowy/api/repository/RegisterRepository.kt @@ -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) } ) diff --git a/src/test/kotlin/io/github/wulkanowy/api/repository/RegisterRepositoryTest.kt b/src/test/kotlin/io/github/wulkanowy/api/repository/RegisterRepositoryTest.kt index 661d1e9d..c58375ce 100644 --- a/src/test/kotlin/io/github/wulkanowy/api/repository/RegisterRepositoryTest.kt +++ b/src/test/kotlin/io/github/wulkanowy/api/repository/RegisterRepositoryTest.kt @@ -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>() 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) } } diff --git a/src/test/resources/io/github/wulkanowy/api/login/Logowanie-uonet.html b/src/test/resources/io/github/wulkanowy/api/login/Logowanie-uonet.html index 782d258d..38490ebf 100644 --- a/src/test/resources/io/github/wulkanowy/api/login/Logowanie-uonet.html +++ b/src/test/resources/io/github/wulkanowy/api/login/Logowanie-uonet.html @@ -3,10 +3,10 @@ Working... -
+ - - + +