use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.
the class ClanServiceTest method generatePlayerInvitationToken.
@Test
public void generatePlayerInvitationToken() throws IOException {
Player requester = new Player();
requester.setId(1);
Player newMember = new Player();
newMember.setId(2);
Clan clan = ClanFactory.builder().leader(requester).build();
FafApiProperties props = new FafApiProperties();
when(clanRepository.findById(clan.getId())).thenReturn(Optional.of(clan));
when(playerRepository.findById(newMember.getId())).thenReturn(Optional.of(newMember));
when(fafApiProperties.getClan()).thenReturn(props.getClan());
instance.generatePlayerInvitationToken(requester, newMember.getId(), clan.getId());
ArgumentCaptor<InvitationResult> captor = ArgumentCaptor.forClass(InvitationResult.class);
verify(jwtService, Mockito.times(1)).sign(captor.capture());
assertThat("expire", captor.getValue().getExpire(), greaterThan(System.currentTimeMillis()));
assertEquals(newMember.getId(), captor.getValue().getNewMember().getId());
assertEquals(newMember.getLogin(), captor.getValue().getNewMember().getLogin());
assertEquals(clan.getId(), captor.getValue().getClan().getId());
assertEquals(clan.getTag(), captor.getValue().getClan().getTag());
assertEquals(clan.getName(), captor.getValue().getClan().getName());
}
use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.
the class TutorialEnricherTest method setUp.
@Before
public void setUp() {
FafApiProperties fafApiProperties = new FafApiProperties();
fafApiProperties.getTutorial().setThumbnailUrlFormat("http://example.com/%s");
instance = new TutorialEnricherListener();
instance.init(fafApiProperties, messageSourceAccessor);
}
use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.
the class ModServiceTest method setUp.
@Before
public void setUp() throws Exception {
FafApiProperties properties = new FafApiProperties();
properties.getMod().setTargetDirectory(temporaryFolder.getRoot().toPath().resolve("mods"));
properties.getMod().setThumbnailTargetDirectory(temporaryFolder.getRoot().toPath().resolve("thumbnails"));
when(modRepository.save(any(Mod.class))).thenAnswer(invocation -> invocation.getArgument(0));
instance = new ModService(properties, modRepository, modVersionRepository);
}
use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.
the class GitHubDeploymentServiceTest method setUp.
@Before
public void setUp() throws Exception {
apiProperties = new FafApiProperties();
instance = new GitHubDeploymentService(applicationContext, apiProperties, featuredModService);
}
use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.
the class LegacyFeaturedModDeploymentTaskTest method setUp.
@Before
public void setUp() throws Exception {
properties = new FafApiProperties();
Deployment deployment = properties.getDeployment();
deployment.setRepositoriesDirectory(repositoriesFolder.getRoot().getAbsolutePath());
deployment.setFeaturedModsTargetDirectory(targetFolder.getRoot().getAbsolutePath());
instance = new LegacyFeaturedModDeploymentTask(gitWrapper, featuredModService, properties);
}
Aggregations