forked from Silverfish/proton-bridge
feat(GODT-2801): Identity State Cloning & Auth Check
This patch moves the `user.User.CheckAuth` function into the `State` type as it contains all the necessary information to perform this check. A couple of more interfaces are added to abstract the retrieval of the Bridge and the User's key passwords, as well as telemetry reports. Finally, adds `State.OnAddressEvents` which other services should use to update the state.
This commit is contained in:
@ -356,17 +356,13 @@ func TestService_OnAddressDeletedUnknownDoesNotProduceEvent(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func newTestService(t *testing.T, mockCtrl *gomock.Controller) (*Service, *mocks2.MockEventPublisher, *mocks.MockIdentityProvider) {
|
||||
func newTestService(_ *testing.T, mockCtrl *gomock.Controller) (*Service, *mocks2.MockEventPublisher, *mocks.MockIdentityProvider) {
|
||||
subscribable := &userevents.NoOpSubscribable{}
|
||||
eventPublisher := mocks2.NewMockEventPublisher(mockCtrl)
|
||||
provider := mocks.NewMockIdentityProvider(mockCtrl)
|
||||
user := newTestUser()
|
||||
|
||||
provider.EXPECT().GetAddresses(gomock.Any()).Times(1).Return(newTestAddresses(), nil)
|
||||
|
||||
service, err := NewService(context.Background(), subscribable, user, eventPublisher, provider)
|
||||
require.NoError(t, err)
|
||||
|
||||
service := NewService(subscribable, eventPublisher, NewState(user, newTestAddresses(), provider))
|
||||
return service, eventPublisher, provider
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user