use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method saveAndSubmitModelingSubmission_classDiagram.
@Test
@WithMockUser(username = "student1")
public void saveAndSubmitModelingSubmission_classDiagram() throws Exception {
database.createAndSaveParticipationForExercise(classExercise, "student1");
ModelingSubmission submission = ModelFactory.generateModelingSubmission(emptyModel, false);
ModelingSubmission returnedSubmission = performInitialModelSubmission(classExercise.getId(), submission);
database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), emptyModel);
checkDetailsHidden(returnedSubmission, true);
returnedSubmission.setModel(validModel);
returnedSubmission.setSubmitted(true);
returnedSubmission = performUpdateOnModelSubmission(classExercise.getId(), returnedSubmission);
database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), validModel);
checkDetailsHidden(returnedSubmission, true);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmissionForModelingEditor.
@Test
@WithMockUser(username = "student1")
public void getModelSubmissionForModelingEditor() throws Exception {
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = (ModelingSubmission) database.addModelingSubmissionWithFinishedResultAndAssessor(classExercise, submission, "student1", "tutor1");
ModelingSubmission receivedSubmission = request.get("/api/participations/" + submission.getParticipation().getId() + "/latest-modeling-submission", HttpStatus.OK, ModelingSubmission.class);
// set dates to UTC and round to milliseconds for comparison
submission.setSubmissionDate(ZonedDateTime.ofInstant(submission.getSubmissionDate().truncatedTo(ChronoUnit.MILLIS).toInstant(), ZoneId.of("UTC")));
receivedSubmission.setSubmissionDate(ZonedDateTime.ofInstant(receivedSubmission.getSubmissionDate().truncatedTo(ChronoUnit.MILLIS).toInstant(), ZoneId.of("UTC")));
assertThat(receivedSubmission).as("submission was found").isEqualTo(submission);
assertThat(receivedSubmission.getLatestResult()).as("result is set").isNotNull();
assertThat(receivedSubmission.getLatestResult().getAssessor()).as("assessor is hidden").isNull();
// students can only see their own models
submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = database.addModelingSubmission(classExercise, submission, "student2");
request.get("/api/participations/" + submission.getParticipation().getId() + "/latest-modeling-submission", HttpStatus.FORBIDDEN, ModelingSubmission.class);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelingSubmissionWithResultIdAsTutor_badRequest.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void getModelingSubmissionWithResultIdAsTutor_badRequest() throws Exception {
User user = database.getUserByLogin("tutor1");
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = (ModelingSubmission) database.addModelingSubmissionWithFinishedResultAndAssessor(classExercise, submission, "student1", "tutor1");
Result storedResult = submission.getResultForCorrectionRound(0);
var params = new LinkedMultiValueMap<String, String>();
params.add("resultId", String.valueOf(storedResult.getId()));
request.get("/api/modeling-submissions/" + submission.getId(), HttpStatus.FORBIDDEN, ModelingSubmission.class, params);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmission.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void getModelSubmission() throws Exception {
User user = database.getUserByLogin("tutor1");
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = database.addModelingSubmission(classExercise, submission, "student1");
ModelingSubmission storedSubmission = request.get("/api/modeling-submissions/" + submission.getId(), HttpStatus.OK, ModelingSubmission.class);
assertThat(storedSubmission.getLatestResult()).as("result has been set").isNotNull();
assertThat(storedSubmission.getLatestResult().getAssessor()).as("assessor is tutor1").isEqualTo(user);
checkDetailsHidden(storedSubmission, false);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmissionWithoutResults.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void getModelSubmissionWithoutResults() throws Exception {
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = database.addModelingSubmission(classExercise, submission, "student1");
ModelingSubmission storedSubmission = request.get("/api/modeling-submissions/" + submission.getId() + "?withoutResults=true", HttpStatus.OK, ModelingSubmission.class);
assertThat(storedSubmission.getLatestResult()).as("result has not been set").isNull();
}
Aggregations