Merge pull request #86
move "Check auth on all routes" extension into the class
This commit was merged in pull request #86.
This commit is contained in:
@@ -84,9 +84,8 @@ class `Check auth on all routes` : BaseTest() {
|
||||
return """HttpStatus ${statusCode.value} for: ${method.value.padStart(6, ' ')} $uri"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Path.buildUrl(path: String, methodName: String, context: OAIContext): String {
|
||||
private fun Path.buildUrl(path: String, methodName: String, context: OAIContext): String {
|
||||
val urlReplaced = this.getParametersIn(context, "path")
|
||||
.fold(path) { pathToReplace: String, parameter: Parameter ->
|
||||
"""\{${parameter.name}}""".toRegex().replace(
|
||||
@@ -121,9 +120,9 @@ private fun Path.buildUrl(path: String, methodName: String, context: OAIContext)
|
||||
}
|
||||
|
||||
return "$urlReplaced$allParameters"
|
||||
}
|
||||
}
|
||||
|
||||
private fun Parameter.generateFakeValue(): String {
|
||||
private fun Parameter.generateFakeValue(): String {
|
||||
return if (example != null) {
|
||||
example.toString()
|
||||
} else if (schema.type == "string" && schema.format == "uuid") {
|
||||
@@ -131,9 +130,9 @@ private fun Parameter.generateFakeValue(): String {
|
||||
} else {
|
||||
"example123"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Parameter.generateFakeArray(): List<String> {
|
||||
private fun Parameter.generateFakeArray(): List<String> {
|
||||
if (schema.type != "array") {
|
||||
error("Parameter is not an array")
|
||||
}
|
||||
@@ -144,4 +143,6 @@ private fun Parameter.generateFakeArray(): List<String> {
|
||||
} else {
|
||||
listOf("example123")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user