Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

untested warning for is_subscription #272

Open
newearthmartin opened this issue Oct 24, 2022 · 4 comments
Open

untested warning for is_subscription #272

newearthmartin opened this issue Oct 24, 2022 · 4 comments

Comments

@newearthmartin
Copy link

newearthmartin commented Oct 24, 2022

Hi, I'm getting an untested warning for PayPalStandardBase.is_subcription()

paypal.standard.models:286: This method (or branch) is not covered by automated tests. It is therefore very vulnerable to being accidentally broken by future versions of django-paypal. Please contribute tests to ensure future functionality!

The method itself is just one line:

    def is_subscription(self):
        warn_untested()
        return len(self.subscr_id) > 0

So I wonder what kind of test would be needed for this. Or if it's pointing to the more generic subscription logic?

@VinneyJ
Copy link

VinneyJ commented Dec 9, 2022

Hi, @newearthmartin I am new to this repo and interested. Is this something I can look into and try solving or was it fixed? and Is there any contributing guide?

@newearthmartin
Copy link
Author

@spookylukey care to answer to this new contributor @VinneyJ ?

@spookylukey
Copy link
Owner

A good test would be like this:

  • Find some examples of IPN/PDT objects that are for subscriptions, from your real data, and locate the important properties
  • Write a test or several tests that creates similar IPN objects, probably in test_ipn.py, using PayPalIPN.objects.create(...)
  • The test should assert that the the relevant properties return True/False for IPN objects that are/are not subscriptions.

It would be nice to add tests for the other methods like is_subscription_payment etc., based on real data, and also make any corrections to these methods as necessary.

@VinneyJ
Copy link

VinneyJ commented Dec 12, 2022

Thanks a lot, @spookylukey let me dive in and check it out.

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

No branches or pull requests

3 participants