Skip to content
Snippets Groups Projects
Commit b0dcd920 authored by William Walker's avatar William Walker
Browse files

test: check courses

parent d5b0aa97
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ import edu.ucsc.its.temerity.model.EventType.NEW_LOG_IN
import edu.ucsc.its.temerity.model.EventType.RECORDING_ERROR
import edu.ucsc.its.temerity.util.currentDate
import io.kotest.common.ExperimentalKotest
import io.kotest.common.KotestInternal
import io.kotest.matchers.file.shouldNotBeEmpty
import kotlinx.coroutines.runBlocking
import kotlinx.datetime.Clock
......@@ -46,7 +47,7 @@ import kotlin.time.Duration.Companion.minutes
import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid
@OptIn(ExperimentalUuidApi::class)
@OptIn(ExperimentalUuidApi::class, KotestInternal::class)
private class ProdReportTests : TemProdFunSpec() {
init {
......@@ -163,29 +164,32 @@ private class ProdReportTests : TemProdFunSpec() {
// "Mislinked" YuJa course report
// Generate Report listing all courses matching specific sis id that have the wrong term code, or are duplicates
test("PlatformClient can fetch a list of courses with specific SIS ID by term and verify that the term code matches the correct one for the quarter") {
runBlocking {
val fullCoursesList = testTemerity.getCourses()
val invalidGroupTerm = fullCoursesList.filter {
it.sisId.startsWith("2250")
}.filter {
it.courseTerm != "2025 Winter Quarter"
test("PlatformClient can fetch a list of courses with specific SIS ID by term and verify that the term code matches the correct one for the quarter")
.config(timeout = 45.minutes) {
runBlocking {
val fullCoursesList = testTemerity.getCourses()
val invalidGroupTerm = fullCoursesList.filter { course ->
course.sisId.startsWith("2252")
}.filter { course ->
course.courseTerm != "2025 Spring Quarter"
}
val nonMatchingSisId = fullCoursesList.filter { course ->
course.courseTerm == "2025 Spring Quarter"
}.filter { course ->
!course.sisId.startsWith("2252") &&
!course.courseCode.endsWith("-DRC") &&
!course.courseCode.contains(" ")
}
val duplicateSisId = fullCoursesList.filter { course ->
course.sisId.startsWith("2252")
}.groupBy { course -> course.sisId }.filter { courseMapEntry -> courseMapEntry.value.size > 1 }.values.flatten()
val problemCourses = invalidGroupTerm + nonMatchingSisId + duplicateSisId
println("Total returned groups count: ${problemCourses.size}")
problemCourses.forEach { course -> kermit.i(course.toString()) }
val df = problemCourses.toDataFrame()
df.writeCSV("wrong-term-duplicate-course-report-${Uuid.random()}-${currentDate()}.csv")
}
val nonMatchingSisId = fullCoursesList.filter {
it.courseTerm == "2025 Winter Quarter"
}.filter {
!it.sisId.startsWith("2250")
}
val duplicateSisId = fullCoursesList.filter {
it.sisId.startsWith("2250")
}.groupBy { it.sisId }.filter { it.value.size > 1 }.values.flatten()
val problemCourses = invalidGroupTerm + nonMatchingSisId + duplicateSisId
println("Total returned groups count: ${problemCourses.size}")
problemCourses.forEach { kermit.i(it.toString()) }
val df = problemCourses.toDataFrame()
df.writeCSV("wrong-term-duplicate-course-report-${Uuid.random()}-${currentDate()}.csv")
}
}
test("YuJaClient can fetch the whole list of groups") {
runBlocking {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment