use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.
the class AuthManagerTest method testGetRemoteUserFromToken.
@Test
public void testGetRemoteUserFromToken() throws Exception {
SignUpResponse response = authManager.signUp(new SignUpCredentials("name", "email", ""));
BackendUser user = response.get();
assertEquals(user.getUsername(), "name");
BackendUser credentials = authManager.getUserFromAuthToken(user.getAuthToken()).toBlockingObservable().first();
assertEquals(credentials.getUsername(), "name");
}
use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.
the class AuthManagerTest method testSignUp.
@Test
public void testSignUp() throws Exception {
SignUpResponse response = authManager.signUp(new SignUpCredentials("name", "email", ""));
assertEquals(response.get().getUsername(), "name");
}
use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.
the class AuthManagerTest method testLogin.
@Test
public void testLogin() throws Exception {
SignUpCredentials signUpCredentials = new SignUpCredentials("name", "email", "");
String unEncryptedPW = signUpCredentials.getPassword();
BackendUser signInUser = authManager.signUp(signUpCredentials).get();
BackendUser user = authManager.login(new LoginCredentials(signInUser.getEmailAddress(), unEncryptedPW)).get();
assertNotNull(user);
assertEquals(signInUser.getUsername(), user.getUsername());
}
use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.
the class DataManagerTest method testSend.
@Test
public void testSend() throws Exception {
SignUpResponse response = authManager.signUp(new SignUpCredentials("name", "email", ""));
assertEquals(response.get().getUsername(), "name");
BackendServices.remote().save(new BackendObject()).toBlockingObservable();
}
use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.
the class BackendUser method signUp.
/**
* Synchronously sign up using credentials provided via constructor or setters.
* @return boolean indicating sign up success
*/
public boolean signUp() {
SignUpCredentials creds = new SignUpCredentials(getUsername(), getEmailAddress(), getPassword());
SignUpResponse response = getAM().signUp(creds);
if (response.getStatus().isSuccess()) {
this.initFrom(response.get());
return true;
} else
return false;
}
Aggregations