Page MenuHome

Fix the tests and other minor cleanup
AbandonedPublic

Authored by Sem Mulder (SemMulder) on Mar 26 2020, 3:45 PM.

Diff Detail

Repository
rL Looper
Branch
review2/05/tests_and_misc
Build Status
Buildable 7343
Build 7343: arc lint + arc unit

Event Timeline

Revert the lookup of the PaymentMethod on the Customer

Sybren A. Stüvel (sybren) requested changes to this revision.Mar 31 2020, 12:11 PM

The fixtures systemuser.json and testuser.json are now a bit weird. They still add a customer and a user each, but these are no longer related to each other.

There are tests that depend on specific values for settings in tests/settings.example.py, for example the LOOPER_CAN_CHANGE_CUSTOMER_FUNCTION setting and the functions defined above it. It would be nice if these were separated in the settings, so that it's clear what a developer can/should change (like the database settings) and what should not be touched because it's expected to have that value in tests.

tests/base.py
35

The fixture that creates the harry@blender.org user also creates a customer. Why is it required to create another Customer here?

tests/test_add_payment_method.py
15

Why is this, if the code under test even explicitly turns off reCAPTCHA? This should at least be mentioned here.

82–88

That's some formatting I wouldn't have thought up myself, but it's surprisingly readable. Is that Black auto-formatting like this?

tests/test_checkout.py
246

Why is the check on the status code removed? The status code is reflected in the web server's access logs, which can help us to filter out & ban IP addresses that consistently fail the CAPTCHA.

379–402

Why were this test and the other test for the geolocation-dependent preferred currency removed? Obviously the geolocation still happens, as the GeoIP database is part of the example settings.

385–390

All this code is unnecessary if you never check the value of activated_subs.

This revision now requires changes to proceed.Mar 31 2020, 12:11 PM
Sem Mulder (SemMulder) marked 6 inline comments as done.
  • Address raised concerns
tests/base.py
35

Good catch, it's not. I now lookup the one from the fixture.

tests/test_add_payment_method.py
15

This is something that is left over from copying some stuff, oops. Removed now.

82–88

Yes, that's Black.

tests/test_checkout.py
246

Added it back in.

379–402

These tests are for the DefaultPlanVariation view. That view no longer exists, now the user picks the PlanVariation using a radio during checkout (instead of upfront).

I assume by the others you mean tests/test_preferred_currency.py? They were removed because I removed support for GET on that endpoint. GET was only used to inject the current currency into the page using AJAX, but this can be done better by passing it to the template context.

  • Fix tests due to changes in previous Differentials

It doesn't look like anything is left in this patch, so this should probably be closed.