-
-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed some issues around creating webhooks and improved webhook valid…
…ation that were introduced with the .NET 8 upgrade
- Loading branch information
Showing
14 changed files
with
169 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
tests/Exceptionless.Tests/Controllers/WebHookControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Exceptionless.Core.Models; | ||
using Exceptionless.Core.Utility; | ||
using Exceptionless.Tests.Extensions; | ||
using Exceptionless.Web.Models; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Exceptionless.Tests.Controllers; | ||
|
||
public sealed class WebHookControllerTests : IntegrationTestsBase | ||
{ | ||
public WebHookControllerTests(ITestOutputHelper output, AppWebHostFactory factory) : base(output, factory) { } | ||
|
||
protected override async Task ResetDataAsync() | ||
{ | ||
await base.ResetDataAsync(); | ||
var service = GetService<SampleDataService>(); | ||
await service.CreateDataAsync(); | ||
} | ||
|
||
[Fact] | ||
public Task CanCreateNewWebHook() | ||
{ | ||
return SendRequestAsync(r => r | ||
.Post() | ||
.AsTestOrganizationUser() | ||
.AppendPath("webhooks") | ||
.Content(new NewWebHook | ||
{ | ||
EventTypes = new[] { WebHook.KnownEventTypes.StackPromoted }, | ||
OrganizationId = SampleDataService.TEST_ORG_ID, | ||
ProjectId = SampleDataService.TEST_PROJECT_ID, | ||
Url = "https://localhost/test" | ||
}) | ||
.StatusCodeShouldBeCreated() | ||
); | ||
} | ||
|
||
[Fact] | ||
public Task CreateNewWebHookWithInvalidEventTypeFails() | ||
{ | ||
return SendRequestAsync(r => r | ||
.Post() | ||
.AsTestOrganizationUser() | ||
.AppendPath("webhooks") | ||
.Content(new NewWebHook | ||
{ | ||
EventTypes = new[] { "Invalid" }, | ||
OrganizationId = SampleDataService.TEST_ORG_ID, | ||
ProjectId = SampleDataService.TEST_PROJECT_ID, | ||
Url = "https://localhost/test" | ||
}) | ||
.StatusCodeShouldBeBadRequest() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters