Try to fix tests
This commit is contained in:
parent
09637dbca2
commit
beae2274cd
4 changed files with 34 additions and 16 deletions
|
@ -12,6 +12,8 @@ jobs:
|
|||
- restore_cache:
|
||||
key: cache-{{ checksum "build.gradle" }}
|
||||
|
||||
- run: ./.circleci/host-hotfix.sh
|
||||
|
||||
- run: ./gradlew build -x check --no-daemon --stacktrace --console=plain -PdisablePreDex
|
||||
|
||||
- run: ./gradlew check jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
|
||||
|
|
7
.circleci/host-hotfix.sh
Executable file
7
.circleci/host-hotfix.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "127.0.0.1 fakelog.localhost" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 adfs.fakelog.localhost" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 cufs.fakelog.localhost" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 uonetplus.fakelog.localhost" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 uonetplus-opiekun.fakelog.localhost" | sudo tee -a /etc/hosts
|
|
@ -16,6 +16,16 @@ import org.junit.Test
|
|||
|
||||
class LoginTest : BaseTest() {
|
||||
|
||||
private val normal by lazy {
|
||||
LoginRepository("http", "localhost:3000", "default",
|
||||
getService(LoginService::class.java, "http://localhost:3000/"))
|
||||
}
|
||||
|
||||
private val adfs by lazy {
|
||||
LoginRepository("http", "localhost:3001", "default",
|
||||
getService(LoginService::class.java, "http://localhost:3001/"))
|
||||
}
|
||||
|
||||
private lateinit var server: MockWebServer
|
||||
|
||||
@Before
|
||||
|
@ -23,11 +33,6 @@ class LoginTest : BaseTest() {
|
|||
server = MockWebServer()
|
||||
}
|
||||
|
||||
private fun getRepo(url: String): LoginRepository {
|
||||
return LoginRepository("http", url.removePrefix("http://").removeSuffix("/"), "default",
|
||||
getService(LoginService::class.java, url))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun adfsTest() {
|
||||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("ADFS-form-1.html").readText()))
|
||||
|
@ -37,7 +42,7 @@ class LoginTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Login-success.html").readText()))
|
||||
server.start(3001)
|
||||
|
||||
val res = getRepo(server.url("/").toString()).login("jan@fakelog.cf", "jan123").blockingGet()
|
||||
val res = adfs.login("jan@fakelog.cf", "jan123").blockingGet()
|
||||
|
||||
assertTrue(res.schools.isNotEmpty())
|
||||
}
|
||||
|
@ -48,7 +53,7 @@ class LoginTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Login-success.html").readText()))
|
||||
server.start(3000)
|
||||
|
||||
val res = getRepo(server.url("/").toString()).login("jan@fakelog.cf", "jan123").blockingGet()
|
||||
val res = normal.login("jan@fakelog.cf", "jan123").blockingGet()
|
||||
|
||||
assertTrue(res.schools.isNotEmpty())
|
||||
}
|
||||
|
@ -60,7 +65,7 @@ class LoginTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-adfs-zle-haslo.html").readText()))
|
||||
server.start(3001)
|
||||
|
||||
val res = getRepo(server.url("/").toString()).login("jan@fakelog.cf", "jan1234")
|
||||
val res = adfs.login("jan@fakelog.cf", "jan1234")
|
||||
val observer = TestObserver<HomepageResponse>()
|
||||
res.subscribe(observer)
|
||||
observer.assertTerminated()
|
||||
|
@ -73,7 +78,7 @@ class LoginTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-normal-zle-haslo.html").readText()))
|
||||
server.start(3000)
|
||||
|
||||
val res = getRepo(server.url("/").toString()).login("jan@fakelog.cf", "jan1234")
|
||||
val res = normal.login("jan@fakelog.cf", "jan1234")
|
||||
val observer = TestObserver<HomepageResponse>()
|
||||
res.subscribe(observer)
|
||||
observer.assertTerminated()
|
||||
|
@ -86,7 +91,7 @@ class LoginTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-brak-dostepu.html").readText()))
|
||||
server.start(3000)
|
||||
|
||||
val res = getRepo(server.url("/").toString()).login("jan@fakelog.cf", "jan123")
|
||||
val res = normal.login("jan@fakelog.cf", "jan123")
|
||||
val observer = TestObserver<HomepageResponse>()
|
||||
res.subscribe(observer)
|
||||
observer.assertTerminated()
|
||||
|
|
|
@ -23,6 +23,16 @@ class RegisterTest : BaseTest() {
|
|||
server = MockWebServer()
|
||||
}
|
||||
|
||||
private val login by lazy {
|
||||
LoginRepository("http", "localhost:3000", "default",
|
||||
getService(LoginService::class.java, "http://localhost:3000/"))
|
||||
}
|
||||
|
||||
private val normal by lazy {
|
||||
RegisterRepository("default", "jan@fakelog.localhost", "jan123", login,
|
||||
getService(StudentAndParentService::class.java, "http://localhost:3000/"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pupilsTest() {
|
||||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-uonet.html").readText()))
|
||||
|
@ -36,12 +46,6 @@ class RegisterTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-brak-dostepu.html").readText()))
|
||||
server.start(3000)
|
||||
|
||||
val url = server.url("/").toString()
|
||||
val normal = RegisterRepository("default", "jan@fakelog.localhost", "jan123",
|
||||
LoginRepository("http", url.removePrefix("http://").removeSuffix("/"), "default",
|
||||
getService(LoginService::class.java, url)),
|
||||
getService(StudentAndParentService::class.java, url))
|
||||
|
||||
val res = normal.getPupils().blockingGet()
|
||||
|
||||
assertEquals(1, res.size)
|
||||
|
|
Loading…
Reference in a new issue