public void testLoginRedirects() throws IOException { String redirect = "/abc123?nested=query&string"; configureRedirectString(redirect); attemptLogin("frodo@example.com", "password", true); verify(resp).sendRedirect(redirect); }
public void testUserWithNoDomainGetsDomainAutomaticallyAdded() throws Exception { attemptLogin("frodo@example.com", "password", true); verify(resp).sendRedirect("/"); }
public void testGetRedirects() throws IOException { String location = "/abc123?nested=query&string"; when(req.getSession(false)).thenReturn(session); when(manager.getLoggedInUser(session)).thenReturn(USER); configureRedirectString(location); servlet.doGet(req, resp); verify(resp).sendRedirect(location); }
public void testValidLoginWorks() throws IOException { attemptLogin("frodo@example.com", "password", true); verify(resp).sendRedirect("/"); }
public void testGetRedirects() throws IOException { String location = "/abc123?nested=query&string"; when(req.getSession(eq(false))).thenReturn(session); when(manager.getLoggedInUser(eq(session))).thenReturn(USER); when(manager.getLoggedInUser(eq(req))).thenReturn(USER); configureRedirectString(location); servlet.doGet(req, resp); verify(resp).sendRedirect(location); }
public void testLoginRedirects() throws IOException { String redirect = "/abc123?nested=query&string"; configureRedirectString(redirect); attemptLogin("frodo@example.com", "password", true); verify(resp).sendRedirect(redirect); }
public void testValidLoginWorks() throws IOException { attemptLogin("frodo@example.com", "password", true); verify(resp).sendRedirect("/"); }
public void testUserWithNoDomainReturnAddress() throws Exception { configureRedirectString("none"); attemptLogin("frodo@example.com", "password", true); verify(resp.getWriter()).write( "{ \"participantId\" : \"" + "frodo@example.com" + "\", " + " \"sessionId\" : \"" + "" + "\" }"); }
public void testUserWithNoDomainGetsDomainAutomaticallyAdded() throws Exception { attemptLogin("frodo", "password", true); verify(resp).sendRedirect("/"); }
public void testLoginDoesNotRedirectToRemoteSite() throws IOException { configureRedirectString("http://example.com/other/site"); attemptLogin("frodo@example.com", "password", true); verify(resp, never()).sendRedirect(anyString()); }
public void testInvalidUsernameReturns403() throws IOException { attemptLogin("madeup@example.com", "incorrect", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); verify(session, never()).setAttribute(eq("address"), anyString()); }
public void testLoginDoesNotRedirectToRemoteSite() throws IOException { configureRedirectString("http://example.com/other/site"); attemptLogin("frodo@example.com", "password", true); verify(resp, never()).sendRedirect(anyString()); }
public void testIncorrectPasswordReturns403() throws IOException { attemptLogin("frodo@example.com", "incorrect", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); verify(session, never()).setAttribute(eq("user"), anyString()); }
public void testIncorrectPasswordReturns403() throws IOException { attemptLogin("frodo@example.com", "incorrect", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); verify(session, never()).setAttribute(eq("user"), anyString()); }
public void testInvalidUsernameReturns403() throws IOException { attemptLogin("madeup@example.com", "incorrect", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); verify(session, never()).setAttribute(eq("address"), anyString()); }
public void testAnonymousLogin() throws IOException { attemptLogin(ANONYMOUS_USER.getAddress(), "", true); }