Added testcase for SQL injection lesson
This commit is contained in:
@ -25,11 +25,10 @@
|
||||
|
||||
package org.owasp.webgoat.assignments;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.owasp.webgoat.i18n.PluginMessages;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class AttackResult {
|
||||
|
||||
public static class AttackResultBuilder {
|
||||
@ -89,6 +88,11 @@ public class AttackResult {
|
||||
@Getter
|
||||
private String output;
|
||||
|
||||
public AttackResult(boolean lessonCompleted, String feedback, String output) {
|
||||
this.lessonCompleted = lessonCompleted;
|
||||
this.feedback = StringEscapeUtils.escapeJson(feedback);
|
||||
this.output = StringEscapeUtils.escapeJson(output);
|
||||
}
|
||||
|
||||
public static AttackResultBuilder builder(PluginMessages messages) {
|
||||
return new AttackResultBuilder(messages);
|
||||
|
@ -2,7 +2,7 @@ package org.owasp.webgoat.plugins;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.owasp.webgoat.i18n.Language;
|
||||
import org.owasp.webgoat.i18n.Messages;
|
||||
import org.owasp.webgoat.i18n.PluginMessages;
|
||||
import org.owasp.webgoat.session.WebSession;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.embedded.LocalServerPort;
|
||||
@ -30,7 +30,7 @@ public abstract class LessonTest {
|
||||
@Autowired
|
||||
protected WebApplicationContext wac;
|
||||
@Autowired
|
||||
protected Messages messages;
|
||||
protected PluginMessages messages;
|
||||
@MockBean
|
||||
protected WebSession webSession;
|
||||
@MockBean
|
||||
@ -38,7 +38,8 @@ public abstract class LessonTest {
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
when(language.getLocale()).thenReturn(Locale.US);
|
||||
when(webSession.getUserName()).thenReturn("unit-test");
|
||||
when(language.getLocale()).thenReturn(Locale.getDefault());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user