diff --git a/e2e/mcp/third_party_test.go b/e2e/mcp/third_party_test.go index 2533c48fd..a7e126d8a 100644 --- a/e2e/mcp/third_party_test.go +++ b/e2e/mcp/third_party_test.go @@ -92,6 +92,43 @@ func TestMCP_ThirdParty_CRUD(t *testing.T) { assert.Equal(t, "resource not found", msg) } +func TestMCP_ThirdParty_UpdatePreservesCategoryWhenOmitted(t *testing.T) { + t.Parallel() + owner := testutil.NewClient(t, testutil.RoleOwner) + mc := testutil.NewMCPClient(t, owner) + orgID := owner.GetOrganizationID().String() + + var addResult struct { + ThirdParty struct { + ID string `json:"id"` + Category string `json:"category"` + } `json:"third_party"` + } + + name := factory.SafeName("ThirdParty") + mc.CallToolInto("addThirdParty", map[string]any{ + "organizationId": orgID, + "name": name, + "category": "CLOUD_PROVIDER", + }, &addResult) + require.NotEmpty(t, addResult.ThirdParty.ID) + assert.Equal(t, "CLOUD_PROVIDER", addResult.ThirdParty.Category) + + var updateResult struct { + ThirdParty struct { + ID string `json:"id"` + Name string `json:"name"` + Category string `json:"category"` + } `json:"third_party"` + } + mc.CallToolInto("updateThirdParty", map[string]any{ + "id": addResult.ThirdParty.ID, + "name": "Updated ThirdParty", + }, &updateResult) + assert.Equal(t, "Updated ThirdParty", updateResult.ThirdParty.Name) + assert.Equal(t, "CLOUD_PROVIDER", updateResult.ThirdParty.Category) +} + func TestMCP_ThirdParty_ValidationError(t *testing.T) { t.Parallel() owner := testutil.NewClient(t, testutil.RoleOwner) diff --git a/pkg/probo/third_party_service.go b/pkg/probo/third_party_service.go index dc66544c7..dd131ebe8 100644 --- a/pkg/probo/third_party_service.go +++ b/pkg/probo/third_party_service.go @@ -408,8 +408,6 @@ func (s ThirdPartyService) Update( if req.Category != nil { thirdParty.Category = *req.Category - } else { - thirdParty.Category = coredata.ThirdPartyCategoryOther } if req.SecurityPageURL != nil {