Merge branch 'main' into feat/add-email-template-apis
This commit is contained in:
commit
97b1d8d66f
|
@ -70,11 +70,7 @@ func UpdateWebhookResolver(ctx context.Context, params model.UpdateWebhookReques
|
|||
}
|
||||
|
||||
if params.Headers != nil {
|
||||
for key, val := range params.Headers {
|
||||
webhook.Headers[key] = val
|
||||
}
|
||||
|
||||
headerBytes, err := json.Marshal(webhook.Headers)
|
||||
headerBytes, err := json.Marshal(params.Headers)
|
||||
if err != nil {
|
||||
log.Debug("failed to marshall headers: ", err)
|
||||
return nil, err
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func TestResolvers(t *testing.T) {
|
||||
databases := map[string]string{
|
||||
constants.DbTypeSqlite: "../../data.db",
|
||||
constants.DbTypeSqlite: "../../test.db",
|
||||
// constants.DbTypeArangodb: "http://localhost:8529",
|
||||
// constants.DbTypeMongodb: "mongodb://localhost:27017",
|
||||
// constants.DbTypeScyllaDB: "127.0.0.1:9042",
|
||||
|
|
|
@ -27,7 +27,10 @@ func updateWebhookTest(t *testing.T, s TestSetup) {
|
|||
webhook, err := db.Provider.GetWebhookByEventName(ctx, constants.UserDeletedWebhookEvent)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, webhook)
|
||||
webhook.Headers["x-new-test"] = "new-test"
|
||||
// it should completely replace headers
|
||||
webhook.Headers = map[string]interface{}{
|
||||
"x-new-test": "test",
|
||||
}
|
||||
|
||||
res, err := resolvers.UpdateWebhookResolver(ctx, model.UpdateWebhookRequest{
|
||||
ID: webhook.ID,
|
||||
|
@ -45,8 +48,11 @@ func updateWebhookTest(t *testing.T, s TestSetup) {
|
|||
assert.Equal(t, webhook.ID, updatedWebhook.ID)
|
||||
assert.Equal(t, refs.StringValue(webhook.EventName), refs.StringValue(updatedWebhook.EventName))
|
||||
assert.Equal(t, refs.StringValue(webhook.Endpoint), refs.StringValue(updatedWebhook.Endpoint))
|
||||
assert.Len(t, updatedWebhook.Headers, 2)
|
||||
assert.Len(t, updatedWebhook.Headers, 1)
|
||||
assert.False(t, refs.BoolValue(updatedWebhook.Enabled))
|
||||
for key, val := range updatedWebhook.Headers {
|
||||
assert.Equal(t, val, webhook.Headers[key])
|
||||
}
|
||||
|
||||
res, err = resolvers.UpdateWebhookResolver(ctx, model.UpdateWebhookRequest{
|
||||
ID: webhook.ID,
|
||||
|
|
Loading…
Reference in New Issue
Block a user