public void testUsernameTrimmed() throws Exception { attemptToRegister(req, resp, " ben@example.com ", "beetleguice", false); verify(resp).setStatus(HttpServletResponse.SC_OK); assertNotNull(store.getAccount(ParticipantId.ofUnsafe("ben@example.com"))); }
public void testRegisterUserAtForeignDomainThrowsError() throws Exception { attemptToRegister(req, resp, "bilbo@example2.com", "fdsa", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); assertNull(store.getAccount(ParticipantId.ofUnsafe("bilbo@example2.com"))); }
public void testRegisterExistingUserThrowsError() throws Exception { attemptToRegister(req, resp, "frodo@example.com", "asdf", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); // ... and it should have left the account store unchanged. assertSame(account, store.getAccount(account.getId())); }
public void testNullPasswordWorks() throws Exception { attemptToRegister(req, resp, "zd@example.com", null, false); verify(resp).setStatus(HttpServletResponse.SC_OK); AccountData account = store.getAccount(ParticipantId.ofUnsafe("zd@example.com")); assertNotNull(account); assertTrue(account.asHuman().getPasswordDigest().verify("".toCharArray())); }
public void testNullPasswordWorks() throws Exception { attemptToRegister(req, resp, "zd@example.com", null, false); verify(resp).setStatus(HttpServletResponse.SC_OK); AccountData account = store.getAccount(ParticipantId.ofUnsafe("zd@example.com")); assertNotNull(account); assertTrue(account.asHuman().getPasswordDigest().verify("".toCharArray())); }
public void testRegisterNewUserEnabled() throws Exception { attemptToRegister(req, resp, "foo@example.com", "internet", false); verify(resp).setStatus(HttpServletResponse.SC_OK); ParticipantId participantId = ParticipantId.ofUnsafe("foo@example.com"); AccountData account = store.getAccount(participantId); assertNotNull(account); assertTrue(account.asHuman().getPasswordDigest().verify("internet".toCharArray())); verify(welcomeBot).greet(eq(participantId)); }
public void testRegisterUserAtForeignDomainThrowsError() throws Exception { attemptToRegister(req, resp, "bilbo@example2.com", "fdsa", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); assertNull(store.getAccount(ParticipantId.ofUnsafe("bilbo@example2.com"))); }
public void testUsernameTrimmed() throws Exception { attemptToRegister(req, resp, " ben@example.com ", "beetleguice", false); verify(resp).setStatus(HttpServletResponse.SC_OK); assertNotNull(store.getAccount(ParticipantId.ofUnsafe("ben@example.com"))); }
public void testRegisterExistingUserThrowsError() throws Exception { attemptToRegister(req, resp, "frodo@example.com", "asdf", false); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); // ... and it should have left the account store unchanged. assertSame(account, store.getAccount(account.getId())); }
public void testRegisterNewUserEnabled() throws Exception { attemptToRegister(req, resp, "foo@example.com", "internet", false); verify(resp).setStatus(HttpServletResponse.SC_OK); ParticipantId participantId = ParticipantId.ofUnsafe("foo@example.com"); AccountData account = store.getAccount(participantId); assertNotNull(account); assertTrue(account.asHuman().getPasswordDigest().verify("internet".toCharArray())); verify(welcomeBot).greet(eq(participantId)); }
public void testRegisterNewUserDisabled() throws Exception { attemptToRegister(req, resp, "foo@example.com", "internet", true); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); ParticipantId participantId = ParticipantId.ofUnsafe("foo@example.com"); AccountData account = store.getAccount(participantId); assertNull(account); }
public void testDomainInsertedAutomatically() throws Exception { attemptToRegister(req, resp, "sam", "fdsa", false); verify(resp).setStatus(HttpServletResponse.SC_OK); assertNotNull(store.getAccount(ParticipantId.ofUnsafe("sam@example.com"))); }
public void testRegisterNewUserDisabled() throws Exception { attemptToRegister(req, resp, "foo@example.com", "internet", true); verify(resp).setStatus(HttpServletResponse.SC_FORBIDDEN); ParticipantId participantId = ParticipantId.ofUnsafe("foo@example.com"); AccountData account = store.getAccount(participantId); assertNull(account); }
public void testDomainInsertedAutomatically() throws Exception { attemptToRegister(req, resp, "sam", "fdsa", false); verify(resp).setStatus(HttpServletResponse.SC_OK); assertNotNull(store.getAccount(ParticipantId.ofUnsafe("sam@example.com"))); }