Skip to content

Commit

Permalink
Testi muuttuneetJälkeen haulle
Browse files Browse the repository at this point in the history
  • Loading branch information
a544jh committed Dec 27, 2024
1 parent 7e80dba commit 11432e2
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package fi.oph.koski.massaluovutus

import fi.oph.koski.api.misc.OpiskeluoikeusTestMethodsAmmatillinen
import fi.oph.koski.db.PostgresDriverWithJsonSupport.api.actionBasedSQLInterpolation
import fi.oph.koski.db.QueryMethods
import fi.oph.koski.documentation.{PerusopetusExampleData, YleissivistavakoulutusExampleData}
import fi.oph.koski.henkilo.KoskiSpecificMockOppijat
import fi.oph.koski.http.KoskiErrorCategory
import fi.oph.koski.json.JsonSerializer
Expand Down Expand Up @@ -30,7 +32,7 @@ import java.time.{Duration, LocalDate, LocalDateTime}
import java.util.UUID
import scala.util.matching.Regex

class MassaluovutusSpec extends AnyFreeSpec with KoskiHttpSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach {
class MassaluovutusSpec extends AnyFreeSpec with KoskiHttpSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach with OpiskeluoikeusTestMethodsAmmatillinen {
val app = KoskiApplicationForTests

override protected def beforeAll(): Unit = {
Expand Down Expand Up @@ -635,6 +637,26 @@ class MassaluovutusSpec extends AnyFreeSpec with KoskiHttpSpec with Matchers wit
))
}
}

"Palauttaa oppijan kaikki opiskeluoikeudet jos yksikin on muuttunut" in {
val oppija = KoskiSpecificMockOppijat.moniaEriOpiskeluoikeuksia
val oo = createOrUpdate(oppija, PerusopetusExampleData.päättötodistusOpiskeluoikeus(YleissivistavakoulutusExampleData.helsinginMedialukio))

val query = getQuery(oo.aikaleima.get)
val queryId = addQuerySuccessfully(query, user) { response =>
response.status should equal(QueryState.pending)
response.queryId
}
val complete = waitForCompletion(queryId, user)

val jsonFiles = complete.files.map { file =>
verifyResultAndContent(file, user) {
JsonMethods.parse(response.body)
}
}

(jsonFiles.head.extract[Seq[JObject]].head \ "opiskeluoikeudet").extract[Seq[JObject]].length should equal(8)
}
}

"Suoritusrekisterikysely - oppija-oideilla hakeminen" - {
Expand Down

0 comments on commit 11432e2

Please sign in to comment.