Skip to content

Commit 9dd6a94

Browse files
committed
fixed create users test ouput
1 parent cdaf83d commit 9dd6a94

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

core/src/main/kotlin/org/evomaster/core/output/auth/CreateUsersWriter.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ object CreateUsersWriter {
8282
}
8383
lines.addEmpty()
8484

85+
val resolver = PlaceHolderResolver(user.name, resolverData)
86+
8587
val infoMsg = "Create new user dynamically for ${user.name}"
8688

8789
if(! format.isPython()){
@@ -95,7 +97,7 @@ object CreateUsersWriter {
9597

9698
val resName = responseName(name)
9799

98-
AuthWriter.addBodyOfCallCommand(lines, user.call, testCaseWriter, format, baseUrlOfSut, resName, null)
100+
AuthWriter.addBodyOfCallCommand(lines, user.call, testCaseWriter, format, baseUrlOfSut, resName, resolver)
99101

100102
//need to add check that call was 2xx success or 3xx
101103

@@ -115,6 +117,6 @@ object CreateUsersWriter {
115117

116118
lines.addEmpty()
117119

118-
return PlaceHolderResolver(user.name, resolverData)
120+
return resolver
119121
}
120122
}

core/src/main/kotlin/org/evomaster/core/output/service/HttpWsTestCaseWriter.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,19 +673,28 @@ abstract class HttpWsTestCaseWriter : ApiTestCaseWriter() {
673673
when {
674674
format.isPython() -> {
675675
lines.add("body = ${bodyLines.first()}")
676+
functionsOnString?.forEach { lines.append(it) }
676677
}
677678
format.isJavaScript() -> writeStringifiedPayload(lines, send, bodyLines, functionsOnString)
678679
else -> writeJavaOrKotlinJsonBody(lines, send, bodyLines, dtoVar, functionsOnString)
679680
}
680681
} else {
681682
when {
682683
format.isPython() -> {
683-
lines.add("body = ${bodyLines.first()} + \\")
684+
lines.add("body = ")
685+
if(!functionsOnString.isNullOrEmpty()){
686+
lines.append("(")
687+
}
688+
lines.append("${bodyLines.first()} + \\")
684689
lines.indented {
685690
(1 until bodyLines.lastIndex).forEach { i ->
686691
lines.add("${bodyLines[i]} + \\")
687692
}
688693
lines.add(bodyLines.last())
694+
if(!functionsOnString.isNullOrEmpty()){
695+
lines.append(")")
696+
functionsOnString.forEach { lines.append(it) }
697+
}
689698
}
690699
}
691700
format.isJavaScript() -> writeStringifiedPayload(lines, send, bodyLines, functionsOnString)

0 commit comments

Comments
 (0)