-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1208 from phac-nml/fix-sync-without-project-hash-rel
hotfix: Fixed syncing remote projects from version 20.09 and older.
- Loading branch information
Showing
4 changed files
with
70 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...cility/bioinformatics/irida/repositories/remote/impl/ProjectRemoteRepositoryImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ca.corefacility.bioinformatics.irida.repositories.remote.impl; | ||
|
||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import ca.corefacility.bioinformatics.irida.exceptions.LinkNotFoundException; | ||
import ca.corefacility.bioinformatics.irida.model.project.Project; | ||
import ca.corefacility.bioinformatics.irida.repositories.remote.ProjectRemoteRepository; | ||
import ca.corefacility.bioinformatics.irida.service.RemoteAPITokenService; | ||
import ca.corefacility.bioinformatics.irida.web.controller.api.projects.RESTProjectsController; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class ProjectRemoteRepositoryImplTest { | ||
|
||
private ProjectRemoteRepository projectRemoteRepository; | ||
private RemoteAPITokenService tokenService; | ||
private static final String PROJECT_HASH_REL = RESTProjectsController.PROJECT_HASH_REL; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
tokenService = mock(RemoteAPITokenService.class); | ||
projectRemoteRepository = new ProjectRemoteRepositoryImpl(tokenService); | ||
} | ||
|
||
@Test | ||
public void testReadProjectHashWithoutProjectHashRel() { | ||
Project remoteProject = mock(Project.class); | ||
|
||
when(remoteProject.getLink(PROJECT_HASH_REL)).thenReturn(Optional.empty()); | ||
|
||
assertThrows(LinkNotFoundException.class, () -> { | ||
projectRemoteRepository.readProjectHash(remoteProject); | ||
}); | ||
} | ||
} |