use of io.realm.internal.network.AuthenticateRequest in project realm-java by realm.
the class AuthenticateRequestTests method realmLogin.
// Tests based on the schemas described here: https://github.com/realm/realm-sync-services/blob/master/doc/index.apib
@Test
public void realmLogin() throws URISyntaxException, JSONException {
Token t = SyncTestUtils.createTestUser().getSyncUser().getUserToken();
AuthenticateRequest request = AuthenticateRequest.realmLogin(t, new URI("realm://objectserver/" + t.identity() + "/default"));
JSONObject obj = new JSONObject(request.toJson());
assertEquals("/" + t.identity() + "/default", obj.get("path"));
assertEquals(t.value(), obj.get("data"));
assertEquals("realm", obj.get("provider"));
}
use of io.realm.internal.network.AuthenticateRequest in project realm-java by realm.
the class AuthenticateRequestTests method userRefresh.
@Test
public void userRefresh() throws URISyntaxException, JSONException {
Token t = SyncTestUtils.createTestUser().getSyncUser().getUserToken();
AuthenticateRequest request = AuthenticateRequest.userRefresh(t, new URI("realm://objectserver/" + t.identity() + "/default"));
JSONObject obj = new JSONObject(request.toJson());
assertTrue(obj.has("path"));
assertEquals(t.value(), obj.get("data"));
assertEquals("realm", obj.get("provider"));
}
use of io.realm.internal.network.AuthenticateRequest in project realm-java by realm.
the class AuthenticateRequestTests method userLogin.
@Test
public void userLogin() throws URISyntaxException, JSONException {
AuthenticateRequest request = AuthenticateRequest.userLogin(SyncCredentials.facebook("foo"));
JSONObject obj = new JSONObject(request.toJson());
assertFalse(obj.has("path"));
assertEquals("foo", obj.get("data"));
assertEquals("facebook", obj.get("provider"));
}
Aggregations