Search in sources :

Example 6 with SignUpCredentials

use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.

the class AuthManagerTest method testLoginASync.

@Test
public void testLoginASync() throws Exception {
    SignUpCredentials signUpCredentials = new SignUpCredentials("name", "email", "");
    String unEncryptedPW = signUpCredentials.getPassword();
    BackendUser signInUser = authManager.signUp(signUpCredentials).get();
    BackendUser user = authManager.loginASync(new LoginCredentials(signInUser.getEmailAddress(), unEncryptedPW)).toBlockingObservable().first();
    assertEquals(signInUser.getUsername(), user.getUsername());
}
Also used : LoginCredentials(io.divide.client.auth.credentials.LoginCredentials) SignUpCredentials(io.divide.client.auth.credentials.SignUpCredentials) BackendUser(io.divide.client.BackendUser) ClientTest(io.divide.client.ClientTest) Test(org.junit.Test)

Example 7 with SignUpCredentials

use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.

the class AuthManagerTest method testSendGetUserData.

@Test
public void testSendGetUserData() throws Exception {
    BackendUser user = authManager.signUp(new SignUpCredentials("name", "email", "11")).get();
    user.put("key", "value");
    System.out.println("BEFORE_USER: " + authManager.getUser());
    System.out.println("BEFORE_ID: " + backend.getConfig().id);
    //        user.save();
    authManager.sendUserData(user).toBlockingObservable().first();
    //        user.logout();
    user = authManager.login(new LoginCredentials("email", "11")).get();
    assertNotNull(user);
    assertEquals("value", user.get(String.class, "key"));
}
Also used : LoginCredentials(io.divide.client.auth.credentials.LoginCredentials) SignUpCredentials(io.divide.client.auth.credentials.SignUpCredentials) BackendUser(io.divide.client.BackendUser) ClientTest(io.divide.client.ClientTest) Test(org.junit.Test)

Example 8 with SignUpCredentials

use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.

the class AuthManagerTest method testRecoverFromOneTimeToken.

@Test
public void testRecoverFromOneTimeToken() throws Exception {
    SignUpResponse response = authManager.signUp(new SignUpCredentials("name", "email", ""));
    BackendUser user = response.get();
    assertEquals(user.getUsername(), "name");
    BackendUser credentials = authManager.getUserFromRecoveryToken(user.getRecoveryToken()).toBlockingObservable().first();
    assertNotNull(credentials);
    assertEquals(credentials.getUsername(), "name");
}
Also used : SignUpCredentials(io.divide.client.auth.credentials.SignUpCredentials) BackendUser(io.divide.client.BackendUser) ClientTest(io.divide.client.ClientTest) Test(org.junit.Test)

Example 9 with SignUpCredentials

use of io.divide.client.auth.credentials.SignUpCredentials in project divide by HiddenStage.

the class AuthManagerTest method testSignUpASync.

@Test
public void testSignUpASync() throws Exception {
    BackendUser user = authManager.signUpASync(new SignUpCredentials("name", "email", "")).toBlockingObservable().first();
    assertEquals(user.getUsername(), "name");
}
Also used : SignUpCredentials(io.divide.client.auth.credentials.SignUpCredentials) BackendUser(io.divide.client.BackendUser) ClientTest(io.divide.client.ClientTest) Test(org.junit.Test)

Aggregations

SignUpCredentials (io.divide.client.auth.credentials.SignUpCredentials)9 ClientTest (io.divide.client.ClientTest)8 Test (org.junit.Test)8 BackendUser (io.divide.client.BackendUser)6 LoginCredentials (io.divide.client.auth.credentials.LoginCredentials)3 SignUpResponse (io.divide.client.auth.SignUpResponse)2 BackendObject (io.divide.client.BackendObject)1