package com.gyf.csams import io.ktor.config.* import io.ktor.http.* import io.ktor.server.testing.* import kotlin.test.Test import kotlin.test.assertEquals class ApplicationTest { @Test fun testRoot() { withTestApplication({ module(testing = true) }) { handleRequest(HttpMethod.Get, "/").apply { assertEquals(HttpStatusCode.OK, response.status()) assertEquals("HELLO WORLD!", response.content) } } } @Test fun testRandom(){ val c= randomNum(8) println(c) val d= randomNum(6) println(d) } @Test fun testMd5(){ println("admin".md5()) } @Test fun testInsertUser(){ withTestApplication({ (environment.config as MapApplicationConfig).apply { // Set here the properties put("ktor.deployment.mysql.jdbcUrl", "jdbc:mysql://localhost:3306/csams") put("ktor.deployment.mysql.driverClassName", "com.mysql.cj.jdbc.Driver") put("ktor.deployment.mysql.username", "root") put("ktor.deployment.mysql.password", "123456") } MySQL(testing = true) }) { val c=Service.registered(selectId = "77889") println(c) } } }