use of de.tum.in.www1.artemis.domain.hestia.ExerciseHint in project Artemis by ls1intum.
the class ExerciseHintIntegrationTest method deleteHintAsInstructor.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void deleteHintAsInstructor() throws Exception {
ExerciseHint exerciseHint = new ExerciseHint().content("content 4").title("title 4").exercise(exerciseLite);
request.delete("/api/programming-exercises/" + exerciseHint.getExercise().getId() + "/exercise-hints/" + 0L, HttpStatus.NOT_FOUND);
request.post("/api/programming-exercises/" + exerciseHint.getExercise().getId() + "/exercise-hints", exerciseHint, HttpStatus.CREATED);
List<ExerciseHint> exerciseHints = exerciseHintRepository.findAll();
request.delete("/api/programming-exercises/" + exerciseHint.getExercise().getId() + "/exercise-hints/" + exerciseHints.get(0).getId(), HttpStatus.NO_CONTENT);
}
use of de.tum.in.www1.artemis.domain.hestia.ExerciseHint in project Artemis by ls1intum.
the class ExerciseHintIntegrationTest method getHintForAnExerciseAsAnInstructor.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void getHintForAnExerciseAsAnInstructor() throws Exception {
ExerciseHint exerciseHint = exerciseHintRepository.findAll().get(0);
request.get("/api/programming-exercises/" + exerciseHint.getExercise().getId() + "/exercise-hints/" + exerciseHint.getId(), HttpStatus.OK, ExerciseHint.class);
request.get("/api/programming-exercises/" + exerciseHint.getExercise().getId() + "/exercise-hints/" + 0L, HttpStatus.NOT_FOUND, ExerciseHint.class);
}
use of de.tum.in.www1.artemis.domain.hestia.ExerciseHint in project Artemis by ls1intum.
the class ExerciseHintIntegrationTest method deleteHintWithInvalidExerciseIds.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void deleteHintWithInvalidExerciseIds() throws Exception {
Course course = database.addCourseWithOneProgrammingExercise();
var unrelatedExercise = course.getExercises().stream().findFirst().orElseThrow();
ExerciseHint exerciseHint = exerciseHintRepository.findAll().get(0);
request.delete("/api/programming-exercises/" + unrelatedExercise.getId() + "/exercise-hints/" + exerciseHint.getId(), HttpStatus.CONFLICT);
}
use of de.tum.in.www1.artemis.domain.hestia.ExerciseHint in project Artemis by ls1intum.
the class ExerciseHintIntegrationTest method updateHintWithInvalidExerciseIds.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void updateHintWithInvalidExerciseIds() throws Exception {
Course course = database.addCourseWithOneProgrammingExercise();
var unrelatedExercise = course.getExercises().stream().findFirst().orElseThrow();
ExerciseHint exerciseHint = exerciseHintRepository.findAll().get(0);
exerciseHint.setTitle("New Title");
request.put("/api/programming-exercises/" + unrelatedExercise.getId() + "/exercise-hints/" + exerciseHint.getId(), exerciseHint, HttpStatus.CONFLICT);
}
use of de.tum.in.www1.artemis.domain.hestia.ExerciseHint in project Artemis by ls1intum.
the class ExerciseHintIntegrationTest method createHintAsTutorForbidden.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void createHintAsTutorForbidden() throws Exception {
ExerciseHint exerciseHint = new ExerciseHint().content("content 4").title("title 4").exercise(exerciseLite);
request.post("/api/programming-exercises/" + exerciseHint.getExercise().getId() + "/exercise-hints/", exerciseHint, HttpStatus.FORBIDDEN);
}
Aggregations