Skip to content

Commit 3385cbb

Browse files
authored
fix: param nesting for report creation requests (closes #658) (#659)
# Description The params were not nested at the root level for report creation which is required so params like `columns` and `additional_columns` were not accepted at the API. This PR corrects the nesting to put them at the root which should fix these params when generating reports. (closes #658) Additionally, un-nested all cassette files. Years ago we tested this lib against multiple frameworks at once which required multiple sets of cassettes which is no longer the case. The cassettes nested in a `net` folder is no longer helpful, moving them up a level. Finally, cleaned up a similar problem with webhooks that lingered from years earlier where to avoid collisions, we had to differentiate the urls used in webhook generation based on net version in use. Removed that as a part of this too. <!-- Please provide a general summary of your PR changes and link any related issues or other pull requests. --> # Testing Re-recorded all affected cassettes (otherwise cassettes just moved location). <!-- Please provide details on how you tested this code. See below. - All pull requests must be tested (unit tests where possible with accompanying cassettes, or provide a screenshot of end-to-end testing when unit tests are not possible) - New features must get a new unit test - Bug fixes/refactors must re-record existing cassettes --> # Pull Request Type Please select the option(s) that are relevant to this PR. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Improvement (fixing a typo, updating readme, renaming a variable name, etc)
1 parent 2036b73 commit 3385cbb

267 files changed

Lines changed: 1100 additions & 1697 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions

EasyPost.Integration/TestUtils.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using EasyVCR;
55

66
// ReSharper disable once CheckNamespace
7-
namespace EasyPost.Integration.Utilities
7+
namespace EasyPost.Integration
88
{
99
public class Utils
1010
{
@@ -74,21 +74,6 @@ internal static string ReadFile(string path)
7474
return File.ReadAllText(filePath);
7575
}
7676

77-
internal static string NetVersion
78-
{
79-
get
80-
{
81-
// ReSharper disable once RedundantAssignment
82-
// ReSharper disable once ConvertToConstant.Local
83-
string netVersion = "net";
84-
#if NET472
85-
netVersion = "netstandard";
86-
#endif
87-
88-
return netVersion;
89-
}
90-
}
91-
9277
// ReSharper disable once InconsistentNaming
9378
public class VCR
9479
{
@@ -123,9 +108,6 @@ public VCR(string? testCassettesFolder = null, ApiKey apiKey = ApiKey.Test)
123108

124109
_testCassettesFolder = Path.Combine(GetSourceFileDirectory(), CassettesFolder); // create "cassettes" folder in same directory as test files
125110

126-
string netVersionFolder = NetVersion;
127-
128-
_testCassettesFolder = Path.Combine(_testCassettesFolder, netVersionFolder); // create .NET version-specific folder in "cassettes" folder
129111

130112
if (testCassettesFolder != null)
131113
{

EasyPost.Integration/cassettes/net/synchronous/async.json renamed to EasyPost.Integration/cassettes/synchronous/async.json

File renamed without changes.

EasyPost.Integration/cassettes/net/synchronous/via_get_awaiter.json renamed to EasyPost.Integration/cassettes/synchronous/via_get_awaiter.json

File renamed without changes.

EasyPost.Integration/cassettes/net/synchronous/via_result.json renamed to EasyPost.Integration/cassettes/synchronous/via_result.json

File renamed without changes.

EasyPost.Integration/cassettes/net/synchronous_mvc_controller/async.json renamed to EasyPost.Integration/cassettes/synchronous_mvc_controller/async.json

File renamed without changes.

EasyPost.Integration/cassettes/net/synchronous_mvc_controller/via_task_factory.json renamed to EasyPost.Integration/cassettes/synchronous_mvc_controller/via_task_factory.json

File renamed without changes.

EasyPost.Tests/ServicesTests/EventServiceTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public async Task TestRetrieveAllPayloads()
101101
UseVCR("retrieve_payloads_for_event");
102102

103103
// Create a webhook to receive the event
104-
string url = $"https://example.com/all_payloads/{TestUtils.NetVersion}";
104+
string url = "https://example.com/all_payloads";
105105
Webhook webhook = await Client.Webhook.Create(new Dictionary<string, object> { { "url", url } });
106106
CleanUpAfterTest(webhook.Id);
107107

@@ -129,7 +129,7 @@ public async Task TestRetrievePayload()
129129
UseVCR("retrieve_payload_for_event");
130130

131131
// Create a webhook to receive the event
132-
string url = $"https://example.com/single_payload/{TestUtils.NetVersion}";
132+
string url = $"https://example.com/single_payload";
133133
Webhook webhook = await Client.Webhook.Create(new Dictionary<string, object> { { "url", url } });
134134
CleanUpAfterTest(webhook.Id);
135135

EasyPost.Tests/ServicesTests/WebhookServiceTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public async Task TestCreate()
4040
{
4141
UseVCR("create");
4242

43-
string url = $"https://example.com/create/{TestUtils.NetVersion}";
43+
string url = $"https://example.com/create";
4444

4545
Dictionary<string, object> webhookParams = new Dictionary<string, object>()
4646
{
@@ -79,7 +79,7 @@ public async Task TestRetrieve()
7979
{
8080
UseVCR("retrieve");
8181

82-
string url = $"https://example.com/retrieve/{TestUtils.NetVersion}";
82+
string url = $"https://example.com/retrieve";
8383

8484
Webhook webhook = await Client.Webhook.Create(new Dictionary<string, object> { { "url", url } });
8585
CleanUpAfterTest(webhook.Id);
@@ -159,7 +159,7 @@ public async Task TestUpdate()
159159
{
160160
UseVCR("update");
161161

162-
string url = $"https://example.com/update/{TestUtils.NetVersion}";
162+
string url = $"https://example.com/update";
163163

164164
Webhook webhook = await Client.Webhook.Create(new Dictionary<string, object> { { "url", url } });
165165
CleanUpAfterTest(webhook.Id);
@@ -188,7 +188,7 @@ public async Task TestDelete()
188188
{
189189
UseVCR("delete");
190190

191-
string url = $"https://example.com/delete/{TestUtils.NetVersion}";
191+
string url = $"https://example.com/delete";
192192

193193
Webhook webhook = await Client.Webhook.Create(new Dictionary<string, object> { { "url", url } });
194194
CleanUpAfterTest(webhook.Id);

EasyPost.Tests/ServicesTests/WithParameters/WebhookServiceTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public async Task TestCreate()
4040
{
4141
UseVCR("create");
4242

43-
string url = $"https://example.com/beta/create/{TestUtils.NetVersion}";
43+
string url = $"https://example.com/beta/create";
4444

4545
Dictionary<string, object> data = new Dictionary<string, object> { { "url", url } };
4646

@@ -80,7 +80,7 @@ public async Task TestUpdate()
8080
{
8181
UseVCR("update");
8282

83-
string url = $"https://example.com/beta/update/{TestUtils.NetVersion}";
83+
string url = $"https://example.com/beta/update";
8484
Parameters.Webhook.Create webhookParameters = new()
8585
{
8686
Url = url,

0 commit comments

Comments
 (0)