mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-21 17:46:48 +00:00
refactor: don't pass client directly to store syncer
This commit is contained in:
@ -94,7 +94,6 @@ func mockConnectedUser(m mocks) {
|
||||
|
||||
m.credentialsStore.EXPECT().Get("user").Return(testCredentials, nil),
|
||||
m.pmapiClient.EXPECT().AuthRefresh("token").Return(testAuthRefresh, nil),
|
||||
//TODO m.credentialsStore.EXPECT().UpdateToken("user", ":reftok").Return(nil),
|
||||
|
||||
m.pmapiClient.EXPECT().Unlock(testCredentials.MailboxPassword).Return(nil, nil),
|
||||
m.pmapiClient.EXPECT().UnlockAddresses([]byte(testCredentials.MailboxPassword)).Return(nil),
|
||||
@ -106,6 +105,20 @@ func mockConnectedUser(m mocks) {
|
||||
)
|
||||
}
|
||||
|
||||
// mockAuthUpdate simulates bridge calling UpdateAuthToken on the given user.
|
||||
// This would normally be done by Bridge when it receives an auth from the ClientManager,
|
||||
// but as we don't have a full bridge instance here, we do this manually.
|
||||
func mockAuthUpdate(user *User, token string, m mocks) {
|
||||
gomock.InOrder(
|
||||
m.credentialsStore.EXPECT().UpdateToken("user", ":"+token).Return(nil),
|
||||
m.credentialsStore.EXPECT().Get("user").Return(credentialsWithToken(token), nil),
|
||||
)
|
||||
|
||||
user.updateAuthToken(refreshWithToken(token))
|
||||
|
||||
waitForEvents()
|
||||
}
|
||||
|
||||
func TestNewBridgeWithConnectedUser(t *testing.T) {
|
||||
m := initMocks(t)
|
||||
defer m.ctrl.Finish()
|
||||
|
||||
Reference in New Issue
Block a user