mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-14 22:04:22 +00:00
Changes (#195)
* Changes added * Reading of events for applications changed. * Proto changed * Tests added * Added more tests. * Struct for Data expanded with additional fields. * refactoring * Changes from review. * Merge in to Master * Changes from review. * fix: generate proto Co-authored-by: Fabiennne <fabienne.gerschwiler@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package eventsourcing
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
mock_cache "github.com/caos/zitadel/internal/cache/mock"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/eventstore/mock"
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
"github.com/caos/zitadel/internal/id"
|
||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||
"github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||
repo_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||
"github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -275,3 +277,57 @@ func GetMockProjectGrantMemberByIDsOK(ctrl *gomock.Controller) *ProjectEventstor
|
||||
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||
return GetMockedEventstore(ctrl, mockEs)
|
||||
}
|
||||
|
||||
func GetMockChangesProjectOK(ctrl *gomock.Controller) *ProjectEventstore {
|
||||
project := model.Project{
|
||||
Name: "MusterProject",
|
||||
}
|
||||
data, err := json.Marshal(project)
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
events := []*es_models.Event{
|
||||
&es_models.Event{AggregateID: "AggregateIDProject", Sequence: 1, AggregateType: repo_model.ProjectAggregate, Data: data},
|
||||
}
|
||||
mockEs := mock.NewMockEventstore(ctrl)
|
||||
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||
}
|
||||
|
||||
func GetMockChangesProjectNoEvents(ctrl *gomock.Controller) *ProjectEventstore {
|
||||
events := []*es_models.Event{}
|
||||
mockEs := mock.NewMockEventstore(ctrl)
|
||||
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||
}
|
||||
|
||||
func GetMockedEventstoreComplexity(ctrl *gomock.Controller, mockEs *mock.MockEventstore) *ProjectEventstore {
|
||||
return &ProjectEventstore{
|
||||
Eventstore: mockEs,
|
||||
}
|
||||
}
|
||||
|
||||
func GetMockChangesApplicationOK(ctrl *gomock.Controller) *ProjectEventstore {
|
||||
app := model.Application{
|
||||
Name: "MusterApp",
|
||||
AppID: "AppId",
|
||||
Type: 3,
|
||||
}
|
||||
data, err := json.Marshal(app)
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
events := []*es_models.Event{
|
||||
&es_models.Event{AggregateID: "AggregateIDApp", Type: "project.application.added", Sequence: 1, AggregateType: repo_model.ProjectAggregate, Data: data},
|
||||
}
|
||||
mockEs := mock.NewMockEventstore(ctrl)
|
||||
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||
}
|
||||
|
||||
func GetMockChangesApplicationNoEvents(ctrl *gomock.Controller) *ProjectEventstore {
|
||||
events := []*es_models.Event{}
|
||||
mockEs := mock.NewMockEventstore(ctrl)
|
||||
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user