diff --git a/EasyPost.Tests/Fixture.cs b/EasyPost.Tests/Fixture.cs index 4692fadf..0310edfa 100644 --- a/EasyPost.Tests/Fixture.cs +++ b/EasyPost.Tests/Fixture.cs @@ -36,6 +36,12 @@ public static byte[] EventBody } } + internal static string WebhookHmacSignature => GetFixtureStructure().WebhookHmacSignature; + + internal static string WebhookSecret => GetFixtureStructure().WebhookSecret; + + internal static string WebhookUrl => GetFixtureStructure().WebhookUrl; + internal static Dictionary BasicCarrierAccount => GetFixtureStructure().CarrierAccounts.Basic; internal static Dictionary BasicCustomsInfo => GetFixtureStructure().CustomsInfos.Basic; @@ -122,8 +128,6 @@ internal static string UspsCarrierAccountId internal static string UspsService => GetFixtureStructure().ServiceNames.Usps.FirstService; - internal static string WebhookUrl => GetFixtureStructure().WebhookUrl; - private static FixtureStructure GetFixtureStructure() { string fixtureData = ReadFixtureData(); diff --git a/EasyPost.Tests/ServicesTests/WebhookServiceTest.cs b/EasyPost.Tests/ServicesTests/WebhookServiceTest.cs index eea368d0..719ab072 100644 --- a/EasyPost.Tests/ServicesTests/WebhookServiceTest.cs +++ b/EasyPost.Tests/ServicesTests/WebhookServiceTest.cs @@ -92,14 +92,15 @@ public void TestValidateWebHook() UseVCR("validate_webhook"); byte[] eventData = Fixtures.EventBody; + string webhookHmacSignature = Fixtures.WebhookHmacSignature; + string webhookSecret = Fixtures.WebhookSecret; - // ReSharper disable once StringLiteralTypo - const string webhookSecret = "sécret"; - Dictionary headers = new() { { "X-Hmac-Signature", "hmac-sha256-hex=e93977c8ccb20363d51a62b3fe1fc402b7829be1152da9e88cf9e8d07115a46b" } }; + Dictionary headers = new() { { "X-Hmac-Signature", webhookHmacSignature } }; Event @event = Client.Webhook.ValidateWebhook(eventData, headers, webhookSecret); - Assert.Equal("batch.created", @event.Description); + Assert.Equal("tracker.updated", @event.Description); + Assert.Equal(614.4, @event.Result.Weight); } [Fact] diff --git a/examples b/examples index bcfb3b90..0492e408 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit bcfb3b900550b99e9e4ded9acf4fbd35f1df349f +Subproject commit 0492e408e1b37b2ec18bcb4a4d228ab0f458f59d