fix: make support IM delivery recoverable
Deploy olons-server production / deploy (push) Successful in 3m38s
Deploy olons-server production / deploy (push) Successful in 3m38s
This commit is contained in:
@@ -91,6 +91,24 @@ func TestOpenSessionAutoAcceptsAndReturnsTopic(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenSessionReturnsSameOriginEndpoints(t *testing.T) {
|
||||
repository := &repositoryStub{
|
||||
agent: &store.CustomerService{ID: 3, Name: "客服01", IMTenantCode: "allrich", IMUserID: "usr_agent", OnlineStatus: 1},
|
||||
identity: &store.MemberIMIdentity{TenantID: 0, MemberID: 9, IMTenantCode: "allrich", IMUserID: "usr_member", IMUsername: "member01"},
|
||||
}
|
||||
im := &imStub{}
|
||||
service := New(repository, im, config.AuthConfig{FinanceMasterKey: strings.Repeat("k", 32)})
|
||||
repository.identity.IMPasswordCipher, _ = service.encryptCredential("password")
|
||||
|
||||
session, err := service.OpenSession(context.Background(), 0, 9, 3, SessionRequest{DeviceID: "web-1", Platform: "web"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if session.APIBaseURL != "/v1/im" || session.WebSocketURL != "/v0/channels" || session.FileURL != "/v0/file" {
|
||||
t.Fatalf("browser endpoints must be same-origin paths: %+v", session)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenSessionRepairsDriftedIMCredential(t *testing.T) {
|
||||
repository := &repositoryStub{
|
||||
agent: &store.CustomerService{ID: 3, Name: "客服01", IMTenantCode: "allrich", IMUserID: "usr_agent", OnlineStatus: 1},
|
||||
|
||||
Reference in New Issue
Block a user