mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-27 00:53:18 +01:00
Remove server-side tracking of "supports SMS." Nobody does!
// FREEBIE
This commit is contained in:
@@ -83,7 +83,7 @@ public class AccountControllerTest {
|
||||
ClientResponse response =
|
||||
resources.client().resource(String.format("/v1/accounts/code/%s", "1234"))
|
||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, false, 2222))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 2222))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(ClientResponse.class);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AccountControllerTest {
|
||||
ClientResponse response =
|
||||
resources.client().resource(String.format("/v1/accounts/code/%s", "1111"))
|
||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, false, 3333))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 3333))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(ClientResponse.class);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class AccountControllerTest {
|
||||
ClientResponse response =
|
||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(ClientResponse.class);
|
||||
|
||||
@@ -133,7 +133,7 @@ public class AccountControllerTest {
|
||||
ClientResponse response =
|
||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(ClientResponse.class);
|
||||
|
||||
@@ -151,7 +151,7 @@ public class AccountControllerTest {
|
||||
ClientResponse response =
|
||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||
.header("Authorization", AuthHelper.getAuthHeader("+14151111111", "bar"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(ClientResponse.class);
|
||||
|
||||
@@ -169,7 +169,7 @@ public class AccountControllerTest {
|
||||
ClientResponse response =
|
||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(ClientResponse.class);
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class DeviceControllerTest {
|
||||
|
||||
DeviceResponse response = resources.client().resource("/v1/devices/5678901")
|
||||
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1"))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, true, 1234))
|
||||
.entity(new AccountAttributes("keykeykeykey", false, 1234))
|
||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||
.put(DeviceResponse.class);
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ public class FederatedControllerTest {
|
||||
add(new Device(2, "foo", "bar", "baz", "isgcm", null, null, false, 333, null, System.currentTimeMillis()));
|
||||
}};
|
||||
|
||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, false, singleDeviceList);
|
||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, false, multiDeviceList);
|
||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, singleDeviceList);
|
||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, multiDeviceList);
|
||||
|
||||
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
||||
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
||||
|
||||
@@ -78,8 +78,8 @@ public class MessageControllerTest {
|
||||
add(new Device(3, "foo", "bar", "baz", "isgcm", null, null, false, 444, null, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(31)));
|
||||
}};
|
||||
|
||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, false, singleDeviceList);
|
||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, false, multiDeviceList);
|
||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, singleDeviceList);
|
||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, multiDeviceList);
|
||||
|
||||
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
||||
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
||||
|
||||
@@ -55,8 +55,8 @@ public class ReceiptControllerTest {
|
||||
add(new Device(2, "foo", "bar", "baz", "isgcm", null, null, false, 333, null, System.currentTimeMillis()));
|
||||
}};
|
||||
|
||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, false, singleDeviceList);
|
||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, false, multiDeviceList);
|
||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, singleDeviceList);
|
||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, multiDeviceList);
|
||||
|
||||
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
||||
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
||||
|
||||
@@ -17,9 +17,9 @@ public class ClientContactTest {
|
||||
@Test
|
||||
public void serializeToJSON() throws Exception {
|
||||
byte[] token = Util.getContactToken("+14152222222");
|
||||
ClientContact contact = new ClientContact(token, null, false);
|
||||
ClientContact contactWithRelay = new ClientContact(token, "whisper", false);
|
||||
ClientContact contactWithRelaySms = new ClientContact(token, "whisper", true );
|
||||
ClientContact contact = new ClientContact(token, null);
|
||||
ClientContact contactWithRelay = new ClientContact(token, "whisper");
|
||||
ClientContact contactWithRelaySms = new ClientContact(token, "whisper");
|
||||
|
||||
assertThat("Basic Contact Serialization works",
|
||||
asJson(contact),
|
||||
@@ -28,19 +28,15 @@ public class ClientContactTest {
|
||||
assertThat("Contact Relay Serialization works",
|
||||
asJson(contactWithRelay),
|
||||
is(equalTo(jsonFixture("fixtures/contact.relay.json"))));
|
||||
|
||||
assertThat("Contact Relay+SMS Serialization works",
|
||||
asJson(contactWithRelaySms),
|
||||
is(equalTo(jsonFixture("fixtures/contact.relay.sms.json"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeFromJSON() throws Exception {
|
||||
ClientContact contact = new ClientContact(Util.getContactToken("+14152222222"),
|
||||
"whisper", true);
|
||||
"whisper");
|
||||
|
||||
assertThat("a ClientContact can be deserialized from JSON",
|
||||
fromJson(jsonFixture("fixtures/contact.relay.sms.json"), ClientContact.class),
|
||||
fromJson(jsonFixture("fixtures/contact.relay.json"), ClientContact.class),
|
||||
is(contact));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ public class PreKeyTest {
|
||||
@Test
|
||||
public void deserializeFromJSONV() throws Exception {
|
||||
ClientContact contact = new ClientContact(Util.getContactToken("+14152222222"),
|
||||
"whisper", true);
|
||||
"whisper");
|
||||
|
||||
assertThat("a ClientContact can be deserialized from JSON",
|
||||
fromJson(jsonFixture("fixtures/contact.relay.sms.json"), ClientContact.class),
|
||||
fromJson(jsonFixture("fixtures/contact.relay.json"), ClientContact.class),
|
||||
is(contact));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user