File: test_subscription_search.py

package info (click to toggle)
python-braintree 4.31.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,576 kB
  • sloc: python: 28,946; makefile: 9; sh: 8
file content (49 lines) | stat: -rw-r--r-- 2,108 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from tests.test_helper import *

class TestSubscriptionSearch(unittest.TestCase):
    def test_billing_cycles_remaining_is_a_range_node(self):
        self.assertEqual(Search.RangeNodeBuilder, type(SubscriptionSearch.billing_cycles_remaining))

    def test_created_at_is_a_range_node(self):
        self.assertEqual(Search.RangeNodeBuilder, type(SubscriptionSearch.created_at))

    def test_days_past_due_is_a_range_node(self):
        self.assertEqual(Search.RangeNodeBuilder, type(SubscriptionSearch.days_past_due))

    def test_id_is_a_text_node(self):
        self.assertEqual(Search.TextNodeBuilder, type(SubscriptionSearch.id))

    def test_merchant_account_id_is_a_multiple_value_node(self):
        self.assertEqual(Search.MultipleValueNodeBuilder, type(SubscriptionSearch.merchant_account_id))

    def test_plan_id_is_a_multiple_value_or_text_node(self):
        self.assertEqual(Search.MultipleValueOrTextNodeBuilder, type(SubscriptionSearch.plan_id))

    def test_price_is_a_range_node(self):
        self.assertEqual(Search.RangeNodeBuilder, type(SubscriptionSearch.price))

    def test_status_is_a_multiple_value_node(self):
        self.assertEqual(Search.MultipleValueNodeBuilder, type(SubscriptionSearch.status))

    def test_in_trial_period_is_multiple_value_node(self):
        self.assertEqual(Search.MultipleValueNodeBuilder, type(SubscriptionSearch.in_trial_period))

    def test_status_whitelist(self):
        SubscriptionSearch.status.in_list(
            Subscription.Status.Active,
            Subscription.Status.Canceled,
            Subscription.Status.Expired,
            Subscription.Status.PastDue
        )

    def test_status_not_in_whitelist(self):
        with self.assertRaises(AttributeError):
            SubscriptionSearch.status.in_list(
                Subscription.Status.Active,
                Subscription.Status.Canceled,
                Subscription.Status.Expired,
                "not a status"
            )

    def test_ids_is_a_multiple_value_node(self):
        self.assertEqual(Search.MultipleValueNodeBuilder, type(SubscriptionSearch.ids))