thunderbird_accounts.subscription.tests.test_tasks

Classes

AddSubscriberToMailchimpList([methodName])

PaddleTestCase([methodName])

Base class for Paddle/Celery task unit tests.

PaddleWebhookViewTestCase([methodName])

Test the actual webhook route

ProductCreatedTaskTestCase([methodName])

ProductUpdatedTaskTestCase([methodName])

RemoveTagFromMailchimpMemberTestCase([...])

Unit tests for MailchimpClient.remove_tag_from_member.

SubscriptionCreatedTaskTestCase([methodName])

SubscriptionUpdatedTaskTestCase([methodName])

SubscriptionUpdatedToCancelledTaskTestCase([...])

TransactionCreatedTaskTestCase([methodName])

TransactionUpdatedTaskTestCase([methodName])

UpdateThundermailQuotaTestCase([methodName])

class thunderbird_accounts.subscription.tests.test_tasks.PaddleWebhookViewTestCase(methodName='runTest')[source]

Bases: APITestCase

Test the actual webhook route

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_empty_webhook()

Ensure a webhook that doesn’t have any POST data errors out with an unexpected behaviour error.

test_empty_occurred_at()

Ensure a webhook will raise an unexpected behaviour error if there’s occurred at.

test_success()

Test the minimum amount of data needed to be passed to celery.

test_draft_transactions_are_ignored()

Since this transaction.created event is a draft we ignore it.

test_draft_transactions_arent_ignored_if_they_are_updated()

While we ignore transaction.created with the status of draft, we shouldn’t ignore the unlikely but possible scenario that a transaction updates to a draft.

class thunderbird_accounts.subscription.tests.test_tasks.PaddleTestCase(methodName='runTest')[source]

Bases: TestCase

Base class for Paddle/Celery task unit tests.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

class thunderbird_accounts.subscription.tests.test_tasks.TransactionCreatedTaskTestCase(methodName='runTest')[source]

Bases: PaddleTestCase

test_transaction_already_exists()[source]

We’re testing if the transaction already exists here.

class thunderbird_accounts.subscription.tests.test_tasks.TransactionUpdatedTaskTestCase(methodName='runTest')[source]

Bases: TransactionCreatedTaskTestCase

test_transaction_already_exists()[source]

This isn’t needed in context of TransactionUpdated, but we inherit it so we need to stub it out.

test_transaction_out_of_date()[source]

We’re testing if the transaction is out of date here.

class thunderbird_accounts.subscription.tests.test_tasks.SubscriptionCreatedTaskTestCase(methodName='runTest')[source]

Bases: PaddleTestCase

class thunderbird_accounts.subscription.tests.test_tasks.SubscriptionUpdatedTaskTestCase(methodName='runTest')[source]

Bases: SubscriptionCreatedTaskTestCase

test_subscription_already_exists()[source]

Not needed for update webhook

test_subscription_out_of_date()[source]

We’re testing if the transaction is out of date here.

class thunderbird_accounts.subscription.tests.test_tasks.SubscriptionUpdatedToCancelledTaskTestCase(methodName='runTest')[source]

Bases: SubscriptionCreatedTaskTestCase

test_subscription_already_exists()[source]

Not needed for update webhook

test_subscription_out_of_date()[source]

We’re testing if the transaction is out of date here.

class thunderbird_accounts.subscription.tests.test_tasks.ProductCreatedTaskTestCase(methodName='runTest')[source]

Bases: PaddleTestCase

test_already_exists()[source]

We’re testing if the transaction already exists here.

class thunderbird_accounts.subscription.tests.test_tasks.ProductUpdatedTaskTestCase(methodName='runTest')[source]

Bases: ProductCreatedTaskTestCase

test_already_exists()[source]

This isn’t needed in context of ProductUpdated, but we inherit it so we need to stub it out.

test_out_of_date()[source]

We’re testing if the transaction is out of date here.

class thunderbird_accounts.subscription.tests.test_tasks.UpdateThundermailQuotaTestCase(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

class thunderbird_accounts.subscription.tests.test_tasks.AddSubscriberToMailchimpList(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_success_create(request_mock: MagicMock)

Ensure that given a subscribed user with a valid stalwart email that they will successfully be added to the mailchimp list

test_success_update(request_mock: MagicMock)

Ensure that given a subscribed user with a valid stalwart email that they will successfully have the proper tag added to their entry.

test_bad_user(request_mock: MagicMock)

Ensure that we catch users that do not exist.

test_user_not_subscribed(request_mock: MagicMock)

Ensure that we catch users who are not subscribed

test_bad_request(request_mock: MagicMock)

Ensure we catch bad requests from mailchimp

test_abandoned_cart_tag_removed_on_subscribe(request_mock: MagicMock)

Ensure that the abandoned_cart tag is removed from recovery_email when a user subscribes.

class thunderbird_accounts.subscription.tests.test_tasks.RemoveTagFromMailchimpMemberTestCase(methodName='runTest')[source]

Bases: TestCase

Unit tests for MailchimpClient.remove_tag_from_member.

test_member_not_found_is_noop(request_mock: MagicMock)

If the member does not exist in Mailchimp, return silently without POSTing.

test_tag_absent_is_noop(request_mock: MagicMock)

If the member exists but does not have the tag, return silently without POSTing.

test_tag_present_sends_inactive_post(request_mock: MagicMock)

If the member has the tag, POST with status: inactive to remove it.

test_post_failure_does_not_raise(request_mock: MagicMock, capture_exception_mock: MagicMock)

If the POST to remove the tag fails, log the error but do not raise an exception.