Skip to content

Commit cf0af5c

Browse files
author
Nicolo
committed
#80 Junit test testGetSLOResponseurl for AuthTest
1 parent b158938 commit cf0af5c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

toolkit/src/test/java/com/onelogin/saml2/test/AuthTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,29 @@ public void testGetSLOurl() throws URISyntaxException, IOException, SettingsExce
291291
assertEquals("http://idp.example.com/simplesaml/saml2/idp/SingleLogoutService.php", auth.getSLOurl());
292292
}
293293

294+
295+
/**
296+
* Tests the getSLOResponseUrl method of Auth
297+
*
298+
* @throws IOException
299+
* @throws URISyntaxException
300+
* @throws SettingsException
301+
*
302+
* @see com.onelogin.saml2.Auth#getSLOurl
303+
*/
304+
@Test
305+
public void testGetSLOResponseurl() throws URISyntaxException, IOException, SettingsException {
306+
HttpServletRequest request = mock(HttpServletRequest.class);
307+
HttpServletResponse response = mock(HttpServletResponse.class);
308+
String samlResponseEncoded = Util.getFileAsString("data/responses/response1.xml.base64");
309+
when(request.getParameterMap()).thenReturn(singletonMap("SAMLResponse", new String[]{samlResponseEncoded}));
310+
311+
Saml2Settings settings = new SettingsBuilder().fromFile("config/config.all.properties").build();
312+
313+
Auth auth = new Auth(settings, request, response);
314+
assertEquals("http://idp.example.com/simplesaml/saml2/idp/SingleLogoutServiceResponse.php", auth.getSLOResponseUrl());
315+
}
316+
294317
/**
295318
* Tests the processResponse method of Auth
296319
*

0 commit comments

Comments
 (0)