mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 11:46:53 +00:00
remove primary-device requirement on three accounts grpc endpoints
This commit is contained in:
1 parent
4410da5fb2
commit
98ba337787
2 files changed
+14
-32
No files matched your search
+11
-29
@@ -206,14 +206,17 @@ class AccountsGrpcServiceTest extends SimpleBaseGrpcTest<AccountsGrpcService, Ac
|
||||
getMockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, (byte) (Device.PRIMARY_ID + 1));
|
||||
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
GrpcTestUtils.assertStatusException(Status.INVALID_ARGUMENT, "BAD_AUTHENTICATION",
|
||||
() -> authenticatedServiceStub().deleteAccount(DeleteAccountRequest.newBuilder().build()));
|
||||
final DeleteAccountResponse ignored =
|
||||
authenticatedServiceStub().deleteAccount(DeleteAccountRequest.newBuilder().build());
|
||||
|
||||
verify(accountsManager, never()).delete(any(), any());
|
||||
verify(accountsManager).delete(AUTHENTICATED_ACI, AccountsManager.DeletionReason.USER_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
void setRegistrationLock() {
|
||||
@ParameterizedTest
|
||||
@ValueSource(bytes = { Device.PRIMARY_ID, Device.PRIMARY_ID + 1 })
|
||||
void setRegistrationLock(final byte deviceId) {
|
||||
getMockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, (byte) (deviceId));
|
||||
|
||||
final Account account = mock(Account.class);
|
||||
|
||||
when(accountsManager.getByAccountIdentifier(AUTHENTICATED_ACI))
|
||||
@@ -245,21 +248,11 @@ class AccountsGrpcServiceTest extends SimpleBaseGrpcTest<AccountsGrpcService, Ac
|
||||
verify(accountsManager, never()).update(any(UUID.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void setRegistrationLockLinkedDevice() {
|
||||
@ParameterizedTest
|
||||
@ValueSource(bytes = { Device.PRIMARY_ID, Device.PRIMARY_ID + 1 })
|
||||
void clearRegistrationLock(final byte deviceId) {
|
||||
getMockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, (byte) (Device.PRIMARY_ID + 1));
|
||||
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
GrpcTestUtils.assertStatusException(Status.INVALID_ARGUMENT, "BAD_AUTHENTICATION",
|
||||
() -> authenticatedServiceStub().setRegistrationLock(SetRegistrationLockRequest.newBuilder()
|
||||
.setRegistrationLock(ByteString.copyFrom(TestRandomUtil.nextBytes(32)))
|
||||
.build()));
|
||||
|
||||
verify(accountsManager, never()).update(any(UUID.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void clearRegistrationLock() {
|
||||
final Account account = mock(Account.class);
|
||||
|
||||
when(accountsManager.getByAccountIdentifier(AUTHENTICATED_ACI))
|
||||
@@ -271,17 +264,6 @@ class AccountsGrpcServiceTest extends SimpleBaseGrpcTest<AccountsGrpcService, Ac
|
||||
verify(account).setRegistrationLock(null, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void clearRegistrationLockLinkedDevice() {
|
||||
getMockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, (byte) (Device.PRIMARY_ID + 1));
|
||||
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
GrpcTestUtils.assertStatusException(Status.INVALID_ARGUMENT,
|
||||
() -> authenticatedServiceStub().clearRegistrationLock(ClearRegistrationLockRequest.newBuilder().build()));
|
||||
|
||||
verify(accountsManager, never()).update(any(UUID.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void reserveUsernameHash() throws UsernameHashNotAvailableException {
|
||||
final Account account = mock(Account.class);
|
||||
|
||||
Reference in new issue
Block a user