mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 12:08:03 +01:00
Group atomic account creation operations
This commit is contained in:
committed by
Jon Chambers
parent
c9a9409b9a
commit
fa8f19fd43
@@ -588,16 +588,15 @@ class RegistrationControllerTest {
|
||||
|
||||
final UUID accountIdentifier = UUID.randomUUID();
|
||||
final UUID phoneNumberIdentifier = UUID.randomUUID();
|
||||
final Device device = mock(Device.class);
|
||||
|
||||
final Account account = MockUtils.buildMock(Account.class, a -> {
|
||||
when(a.getUuid()).thenReturn(accountIdentifier);
|
||||
when(a.getPhoneNumberIdentifier()).thenReturn(phoneNumberIdentifier);
|
||||
when(a.getMasterDevice()).thenReturn(Optional.of(device));
|
||||
});
|
||||
|
||||
final Device device = mock(Device.class);
|
||||
|
||||
when(accountsManager.create(any(), any(), any(), any(), any()))
|
||||
.thenReturn(account);
|
||||
when(accountsManager.create(any(), any(), any(), any(), any())).thenReturn(account);
|
||||
|
||||
when(accountsManager.update(eq(account), any())).thenAnswer(invocation -> {
|
||||
final Consumer<Account> accountUpdater = invocation.getArgument(1);
|
||||
@@ -606,13 +605,6 @@ class RegistrationControllerTest {
|
||||
return invocation.getArgument(0);
|
||||
});
|
||||
|
||||
when(accountsManager.updateDevice(eq(account), eq(Device.MASTER_ID), any())).thenAnswer(invocation -> {
|
||||
final Consumer<Device> deviceUpdater = invocation.getArgument(2);
|
||||
deviceUpdater.accept(device);
|
||||
|
||||
return invocation.getArgument(0);
|
||||
});
|
||||
|
||||
final Invocation.Builder request = resources.getJerseyTest()
|
||||
.target("/v1/registration")
|
||||
.request()
|
||||
@@ -623,7 +615,6 @@ class RegistrationControllerTest {
|
||||
}
|
||||
|
||||
verify(accountsManager).create(any(), any(), any(), any(), any());
|
||||
verify(accountsManager).updateDevice(eq(account), eq(Device.MASTER_ID), any());
|
||||
|
||||
verify(account).setIdentityKey(expectedAciIdentityKey);
|
||||
verify(account).setPhoneNumberIdentityKey(expectedPniIdentityKey);
|
||||
|
||||
Reference in New Issue
Block a user