use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class GitServiceIntTest method testGetOrCheckoutRepositoryForExistingRepo.
@Test
public void testGetOrCheckoutRepositoryForExistingRepo() throws IOException, GitAPIException {
Participation participation = new Participation();
participation.setRepositoryUrl(remoteTestRepo);
Repository repo = gitService.getOrCheckoutRepository(participation);
Repository repo2 = gitService.getOrCheckoutRepository(participation);
assertThat(repo.getDirectory()).isEqualTo(repo2.getDirectory());
assertThat(repo2.getBranch()).isEqualTo("master");
assertThat(repo2.getDirectory()).exists();
gitService.deleteLocalRepository(repo2);
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class GitServiceIntTest method testDeleteLocalRepository.
@Test
public void testDeleteLocalRepository() throws IOException, GitAPIException {
Participation participation = new Participation();
participation.setRepositoryUrl(remoteTestRepo);
Repository repo = gitService.getOrCheckoutRepository(participation);
assertThat(repo.getDirectory()).exists();
gitService.deleteLocalRepository(repo);
assertThat(repo.getDirectory()).doesNotExist();
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class GitServiceIntTest method testListFiles.
@Test
public void testListFiles() throws IOException, GitAPIException {
Participation participation = new Participation();
participation.setRepositoryUrl(remoteTestRepo);
Repository repo = gitService.getOrCheckoutRepository(participation);
Collection<de.tum.in.www1.artemis.domain.File> files = gitService.listFiles(repo);
assertThat(files.size()).isGreaterThan(0);
gitService.deleteLocalRepository(repo);
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class LtiServiceIntTest method assertThatUnsuccessfulResultWithoutTextReturnsZeroScore.
@Test
public void assertThatUnsuccessfulResultWithoutTextReturnsZeroScore() {
Participation participation = new Participation();
participationRepository.save(participation);
Result result = new Result();
result.setParticipation(participation);
result.setSuccessful(false);
resultRepository.save(result);
// String score = ltiService.getScoreForParticipation(participation);
// assertThat(score).isEqualTo("0.00");
// cleanup
resultRepository.delete(result);
participationRepository.delete(participation);
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class LtiServiceIntTest method assertThatSuccessfulResultReturnsFullScore.
@Test
public void assertThatSuccessfulResultReturnsFullScore() {
Participation participation = new Participation();
participationRepository.save(participation);
Result result = new Result();
result.setParticipation(participation);
result.setSuccessful(true);
resultRepository.save(result);
// String score = ltiService.getScoreForParticipation(participation);
// assertThat(score).isEqualTo("1.00");
// cleanup
resultRepository.delete(result);
participationRepository.delete(participation);
}
Aggregations