mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Separate capability reads from writes and introduce gv2-2 write flag.
This commit is contained in:
committed by
Greyson Parrelli
parent
15ee8c6cac
commit
74e94f3a97
@@ -0,0 +1,46 @@
|
||||
package org.whispersystems.signalservice.api.account;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.whispersystems.signalservice.internal.util.JsonUtil;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public final class AccountAttributesTest {
|
||||
|
||||
@Test
|
||||
public void can_write_account_attributes() {
|
||||
String json = JsonUtil.toJson(new AccountAttributes("skey",
|
||||
123,
|
||||
true,
|
||||
"1234",
|
||||
"reglock1234",
|
||||
new byte[10],
|
||||
false,
|
||||
new AccountAttributes.Capabilities(true, true, true),
|
||||
false));
|
||||
assertEquals("{\"signalingKey\":\"skey\"," +
|
||||
"\"registrationId\":123," +
|
||||
"\"voice\":true," +
|
||||
"\"video\":true," +
|
||||
"\"fetchesMessages\":true," +
|
||||
"\"pin\":\"1234\"," +
|
||||
"\"registrationLock\":\"reglock1234\"," +
|
||||
"\"unidentifiedAccessKey\":\"AAAAAAAAAAAAAA==\"," +
|
||||
"\"unrestrictedUnidentifiedAccess\":false," +
|
||||
"\"discoverableByPhoneNumber\":false," +
|
||||
"\"capabilities\":{\"uuid\":true,\"storage\":true,\"gv2-2\":true}}", json);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gv2_true() {
|
||||
String json = JsonUtil.toJson(new AccountAttributes.Capabilities(false, true, false));
|
||||
assertEquals("{\"uuid\":false,\"storage\":false,\"gv2-2\":true}", json);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gv2_false() {
|
||||
String json = JsonUtil.toJson(new AccountAttributes.Capabilities(false, false, false));
|
||||
assertEquals("{\"uuid\":false,\"storage\":false,\"gv2-2\":false}", json);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user