mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 10:28:04 +01:00
Discard APNs tokens if the APNs server reports that the token is expired
This commit is contained in:
committed by
Jon Chambers
parent
775889c0b6
commit
02b9ceb4c7
@@ -133,11 +133,12 @@ class APNSenderTest {
|
||||
verifyNoMoreInteractions(apnsClient);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUnregisteredUser() {
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"Unregistered", "BadDeviceToken", "ExpiredToken"})
|
||||
void testUnregisteredUser(final String rejectionReason) {
|
||||
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
||||
when(response.isAccepted()).thenReturn(false);
|
||||
when(response.getRejectionReason()).thenReturn(Optional.of("Unregistered"));
|
||||
when(response.getRejectionReason()).thenReturn(Optional.of(rejectionReason));
|
||||
|
||||
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
||||
.thenAnswer(
|
||||
@@ -160,7 +161,7 @@ class APNSenderTest {
|
||||
assertThat(notification.getValue().getPriority()).isEqualTo(DeliveryPriority.IMMEDIATE);
|
||||
|
||||
assertThat(result.accepted()).isFalse();
|
||||
assertThat(result.errorCode()).hasValue("Unregistered");
|
||||
assertThat(result.errorCode()).hasValue(rejectionReason);
|
||||
assertThat(result.unregistered()).isTrue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user