Skip to content

Commit

Permalink
chore: use new webhook fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Aug 14, 2024
1 parent 4717de3 commit 258db8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 6 additions & 2 deletions EasyPost.Tests/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public static byte[] EventBody
}
}

internal static string WebhookHmacSignature => GetFixtureStructure().WebhookHmacSignature;

Check failure on line 39 in EasyPost.Tests/Fixture.cs

View workflow job for this annotation

GitHub Actions / Coverage_Requirements

'FixtureStructure' does not contain a definition for 'WebhookHmacSignature' and no accessible extension method 'WebhookHmacSignature' accepting a first argument of type 'FixtureStructure' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in EasyPost.Tests/Fixture.cs

View workflow job for this annotation

GitHub Actions / NET_Tests (Net70)

'FixtureStructure' does not contain a definition for 'WebhookHmacSignature' and no accessible extension method 'WebhookHmacSignature' accepting a first argument of type 'FixtureStructure' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in EasyPost.Tests/Fixture.cs

View workflow job for this annotation

GitHub Actions / NET_Tests (Net80)

'FixtureStructure' does not contain a definition for 'WebhookHmacSignature' and no accessible extension method 'WebhookHmacSignature' accepting a first argument of type 'FixtureStructure' could be found (are you missing a using directive or an assembly reference?)

internal static string WebhookSecret => GetFixtureStructure().WebhookSecret;

Check failure on line 41 in EasyPost.Tests/Fixture.cs

View workflow job for this annotation

GitHub Actions / Coverage_Requirements

'FixtureStructure' does not contain a definition for 'WebhookSecret' and no accessible extension method 'WebhookSecret' accepting a first argument of type 'FixtureStructure' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 41 in EasyPost.Tests/Fixture.cs

View workflow job for this annotation

GitHub Actions / NET_Tests (Net70)

'FixtureStructure' does not contain a definition for 'WebhookSecret' and no accessible extension method 'WebhookSecret' accepting a first argument of type 'FixtureStructure' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 41 in EasyPost.Tests/Fixture.cs

View workflow job for this annotation

GitHub Actions / NET_Tests (Net80)

'FixtureStructure' does not contain a definition for 'WebhookSecret' and no accessible extension method 'WebhookSecret' accepting a first argument of type 'FixtureStructure' could be found (are you missing a using directive or an assembly reference?)

internal static string WebhookUrl => GetFixtureStructure().WebhookUrl;

internal static Dictionary<string, object> BasicCarrierAccount => GetFixtureStructure().CarrierAccounts.Basic;

internal static Dictionary<string, object> BasicCustomsInfo => GetFixtureStructure().CustomsInfos.Basic;
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 5 additions & 4 deletions EasyPost.Tests/ServicesTests/WebhookServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object?> headers = new() { { "X-Hmac-Signature", "hmac-sha256-hex=e93977c8ccb20363d51a62b3fe1fc402b7829be1152da9e88cf9e8d07115a46b" } };
Dictionary<string, object?> 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);

Check failure on line 103 in EasyPost.Tests/ServicesTests/WebhookServiceTest.cs

View workflow job for this annotation

GitHub Actions / Coverage_Requirements

'Dictionary<string, object>' does not contain a definition for 'Weight' and no accessible extension method 'Weight' accepting a first argument of type 'Dictionary<string, object>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 103 in EasyPost.Tests/ServicesTests/WebhookServiceTest.cs

View workflow job for this annotation

GitHub Actions / NET_Tests (Net70)

'Dictionary<string, object>' does not contain a definition for 'Weight' and no accessible extension method 'Weight' accepting a first argument of type 'Dictionary<string, object>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 103 in EasyPost.Tests/ServicesTests/WebhookServiceTest.cs

View workflow job for this annotation

GitHub Actions / NET_Tests (Net80)

'Dictionary<string, object>' does not contain a definition for 'Weight' and no accessible extension method 'Weight' accepting a first argument of type 'Dictionary<string, object>' could be found (are you missing a using directive or an assembly reference?)
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion examples
Submodule examples updated 46 files
+13 −16 .github/workflows/ci.yml
+4 −2 Makefile
+21 −0 official/docs/csharp/current/claims/cancel.cs
+43 −0 official/docs/csharp/current/claims/create.cs
+27 −0 official/docs/csharp/current/claims/list.cs
+21 −0 official/docs/csharp/current/claims/retrieve.cs
+2 −0 official/docs/curl/current/claims/cancel.sh
+13 −0 official/docs/curl/current/claims/create.sh
+2 −0 official/docs/curl/current/claims/list.sh
+2 −0 official/docs/curl/current/claims/retrieve.sh
+15 −0 official/docs/golang/current/claims/cancel.go
+25 −0 official/docs/golang/current/claims/create.go
+19 −0 official/docs/golang/current/claims/list.go
+15 −0 official/docs/golang/current/claims/retrieve.go
+15 −0 official/docs/java/current/claims/cancel.java
+30 −0 official/docs/java/current/claims/create.java
+20 −0 official/docs/java/current/claims/list.java
+15 −0 official/docs/java/current/claims/retrieve.java
+9 −0 official/docs/node/current/claims/cancel.js
+18 −0 official/docs/node/current/claims/create.js
+11 −0 official/docs/node/current/claims/list.js
+9 −0 official/docs/node/current/claims/retrieve.js
+7 −0 official/docs/php/current/claims/cancel.php
+19 −0 official/docs/php/current/claims/create.php
+9 −0 official/docs/php/current/claims/list.php
+7 −0 official/docs/php/current/claims/retrieve.php
+7 −0 official/docs/python/current/claims/cancel.py
+16 −0 official/docs/python/current/claims/create.py
+7 −0 official/docs/python/current/claims/list.py
+7 −0 official/docs/python/current/claims/retrieve.py
+40 −0 official/docs/responses/claim/claim-cancel.json
+35 −0 official/docs/responses/claim/claim-create.json
+185 −0 official/docs/responses/claim/claim-list.json
+35 −0 official/docs/responses/claim/claim-retrieve.json
+7 −0 official/docs/ruby/current/claim/cancel.rb
+19 −0 official/docs/ruby/current/claim/create.rb
+9 −0 official/docs/ruby/current/claim/list.rb
+7 −0 official/docs/ruby/current/claim/retrieve.rb
+3 −1 official/fixtures/client-library-fixtures.json
+1 −1 official/fixtures/event-body.json
+23 −0 official/guides/create-carrier-curls/ontracv3.sh
+13 −0 official/guides/create-carrier-curls/quick.sh
+17 −14 official/guides/errors-guide/golang/catch-error.go
+1 −1 style_guides/golang/.golangci.yml
+26 −31 style_guides/node/.eslintrc
+0 −4 style_guides/node/.prettierignore

0 comments on commit 258db8f

Please sign in to comment.