chargebee-python icon indicating copy to clipboard operation
chargebee-python copied to clipboard

Result refactor

Open rcoup opened this issue 7 years ago • 2 comments

This fixes #13, which leads directly to easier mocking/testing of Chargebee APIs too.

It's mostly just cut & paste from result.py to the model classes. The Result._get*() methods no longer pass sub_types/etc to Model__init__(), because they're already defined on the class.

Model.init_dependent_*() methods are no longer called from Result, they're integrated into Model.construct(), and are simpler because there's no need to find and pass the dependent's subtypes.

I've added a test for subtypes using Customer, and a test for Estimate which was the only model using dependent_types.

(includes PR #22, but can refactor if/once that lands)

rcoup avatar Feb 08 '18 12:02 rcoup