Skip to content

Conversation

@sam-levy
Copy link
Contributor

Adds support for Chargebee's delete_a_subscription endpoint;

@sam-levy sam-levy requested a review from a team as a code owner May 19, 2025 18:26
Copy link
Contributor

@klacointe klacointe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No unit test ?

@sam-levy
Copy link
Contributor Author

No unit test ?

Thanks for the warning @klacointe. I added the tests for the delete/1 action. I also added the missing tests for the retrieve/1, list/0 and update/2 actions.

Chargebeex.HTTPClientMock,
:get,
fn url, body, headers ->
assert url == "https://test-namespace.chargebee.com/api/v2/subscriptions/1234"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to module variable @url ?

Copy link
Contributor Author

@sam-levy sam-levy May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are testing different endpoints in this module:

  • /v2/subscriptions;
  • /v2/subscriptions/foobar;
  • /v2/subscriptions/foobar/delete;
  • /v2/customers/foobar/subscription_for_items;
  • /v2/subscriptions/foobar/update_for_items.

Should we create one module attribute for each?
If we decide to use module attributes for these values I guess we should also refactor the other test modules in the project in order to have the same pattern, WDYT @klacointe ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this would impact multiple test modules, IMO this refactoring is outside the scope of this PR. I think it should be done in a separate PR, WDYT @klacointe ?

:get,
fn url, body, headers ->
assert url == "https://test-namespace.chargebee.com/api/v2/subscriptions/1234"
assert headers == [{"Authorization", "Basic dGVzdF9jaGFyZ2VlYmVlX2FwaV9rZXk6"}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to module variable @headers ?

Copy link
Contributor Author

@sam-levy sam-levy May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have [{"Authorization", "Basic dGVzdF9jaGFyZ2VlYmVlX2FwaV9rZXk6"}] headers for GET requests and
[{"Authorization", "Basic dGVzdF9jaGFyZ2VlYmVlX2FwaV9rZXk6"}, {"Content-Type", "application/x-www-form-urlencoded"}] for POST requests. Should we create a @get_headers and a @post_headers module attributes? If so IMO we should refactor the other test modules in order to have the same pattern, WDYT @klacointe ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes ! 😄

@sam-levy
Copy link
Contributor Author

@klacointe Any news on this PR?

FYI @maximemenager @oksanka-blaze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants