forked from baron/baron-sso
웍스 동기화 이력확인 기능추가
This commit is contained in:
@@ -415,6 +415,85 @@ func TestWorksmobileSyncServiceOverviewExposesAdminTenantIDForPasswordManageLink
|
||||
require.Equal(t, "works-tenant-1", overview.Config.AdminTenantID)
|
||||
}
|
||||
|
||||
func TestWorksmobileSyncServiceOverviewKeepsSafeRecentJobChangeLogPayload(t *testing.T) {
|
||||
root := domain.Tenant{
|
||||
ID: "root-tenant",
|
||||
Slug: HanmacFamilyTenantSlug,
|
||||
Name: "한맥가족",
|
||||
}
|
||||
outboxRepo := &fakeWorksmobileOutboxRepo{
|
||||
recent: []domain.WorksmobileOutbox{
|
||||
{
|
||||
ID: "job-user-upsert",
|
||||
ResourceType: domain.WorksmobileResourceUser,
|
||||
ResourceID: "user-1",
|
||||
Action: domain.WorksmobileActionUpsert,
|
||||
Status: domain.WorksmobileOutboxStatusProcessed,
|
||||
Payload: domain.JSONMap{
|
||||
"loginEmail": "changed@example.com",
|
||||
"displayName": "변경 사용자",
|
||||
"primaryLeafOrgName": "인재성장",
|
||||
"initialPassword": "Secret123!",
|
||||
"request": WorksmobileUserPayload{
|
||||
Email: "changed@example.com",
|
||||
UserExternalKey: "user-1",
|
||||
UserName: WorksmobileUserName{LastName: "변경 사용자"},
|
||||
PasswordConfig: WorksmobilePasswordConfig{Password: "Secret123!"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "job-org-upsert",
|
||||
ResourceType: domain.WorksmobileResourceOrgUnit,
|
||||
ResourceID: "org-1",
|
||||
Action: domain.WorksmobileActionUpsert,
|
||||
Status: domain.WorksmobileOutboxStatusProcessed,
|
||||
Payload: domain.JSONMap{
|
||||
"matchLocalPart": "people-growth",
|
||||
"request": WorksmobileOrgUnitPayload{
|
||||
OrgUnitName: "인재성장",
|
||||
Email: "people-growth@example.com",
|
||||
OrgUnitExternalKey: "org-1",
|
||||
ParentOrgUnitID: "externalKey:parent-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
service := NewWorksmobileSyncService(
|
||||
&fakeWorksmobileTenantService{tenants: map[string]domain.Tenant{root.ID: root}},
|
||||
&fakeWorksmobileUserRepo{},
|
||||
outboxRepo,
|
||||
nil,
|
||||
)
|
||||
|
||||
overview, err := service.GetTenantOverview(context.Background(), root.ID)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Len(t, overview.RecentJobs, 2)
|
||||
userPayload := overview.RecentJobs[0].Payload
|
||||
require.Equal(t, "changed@example.com", userPayload["loginEmail"])
|
||||
require.Equal(t, "변경 사용자", userPayload["displayName"])
|
||||
require.Equal(t, "인재성장", userPayload["primaryLeafOrgName"])
|
||||
require.NotContains(t, userPayload, "initialPassword")
|
||||
require.NotContains(t, userPayload, "request")
|
||||
require.Equal(t, domain.JSONMap{
|
||||
"email": "changed@example.com",
|
||||
"displayName": "변경 사용자",
|
||||
"userExternalKey": "user-1",
|
||||
}, userPayload["requestSummary"])
|
||||
|
||||
orgPayload := overview.RecentJobs[1].Payload
|
||||
require.Equal(t, "people-growth", orgPayload["matchLocalPart"])
|
||||
require.NotContains(t, orgPayload, "request")
|
||||
require.Equal(t, domain.JSONMap{
|
||||
"email": "people-growth@example.com",
|
||||
"orgUnitName": "인재성장",
|
||||
"orgUnitExternalKey": "org-1",
|
||||
"parentOrgUnitId": "externalKey:parent-1",
|
||||
}, orgPayload["requestSummary"])
|
||||
}
|
||||
|
||||
func TestCompareWorksmobileGroupsUsesOrganizationsAndBarongroupChildCompanies(t *testing.T) {
|
||||
parentID := "root-tenant"
|
||||
root := domain.Tenant{
|
||||
|
||||
Reference in New Issue
Block a user