use of ca.corefacility.bioinformatics.irida.exceptions.IridaOAuthException in project irida by phac-nml.
the class RemoteAPIControllerTest method testConnectToAPI.
@Test(expected = IridaOAuthException.class)
public void testConnectToAPI() {
Long apiId = 1L;
ExtendedModelMap model = new ExtendedModelMap();
RemoteAPI client = new RemoteAPI("name", "http://uri", "a description", "id", "secret");
when(remoteAPIService.read(apiId)).thenReturn(client);
when(projectRemoteService.getServiceStatus(client)).thenThrow(new IridaOAuthException("invalid token", client));
remoteAPIController.connectToAPI(apiId, model);
}
use of ca.corefacility.bioinformatics.irida.exceptions.IridaOAuthException in project irida by phac-nml.
the class RemoteAPIControllerTest method testHandleOAuthException.
@Test
public void testHandleOAuthException() throws MalformedURLException, OAuthSystemException {
HttpServletRequest request = mock(HttpServletRequest.class);
String redirect = "http://request";
when(request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)).thenReturn(redirect);
RemoteAPI client = new RemoteAPI("name", "http://uri", "a description", "id", "secret");
IridaOAuthException ex = new IridaOAuthException("msg", client);
remoteAPIController.handleOAuthException(request, ex);
verify(authController).authenticate(client, redirect);
}
Aggregations