class TestOrder(unittest.TestCase): """ Testing all methods of the Order abstraction """ def setUp(self): self.order = Order('email') def test_order_init(self): o = Order('test') self.assertIsInstance(o, Order) def test_order_init_sets_typ(self): o = Order('test') self.assertEqual('test', o.typ) def test_order_asc(self): self.order.asc() self.assertEqual(True, self.order.ascending) def test_order_desc(self): self.order.desc() self.assertEqual(False, self.order.ascending) def test_order_to_dict(self): expected = dict(order='email_asc') self.order.ascending = True self.assertDictEqual(expected, self.order.to_dict())
def created_at(cls): """Creates and returns an created_at Order :return: Order object """ return Order(typ='created_at')
def amount(cls): """Creates and returns an amount Order :return: Order object """ return Order(typ='amount')
def client(cls): """Creates and returns an client Order :return: Order object """ return Order(typ='client')
def transaction(cls): """Creates and returns an transaction Order :return: Order object """ return Order(typ='transaction')
def test_order_init_sets_typ(self): o = Order('test') self.assertEqual('test', o.typ)
def test_order_init(self): o = Order('test') self.assertIsInstance(o, Order)
def setUp(self): self.order = Order('email')
def trial_period_days(cls): """Creates and returns an trial_period_days Order :return: Order object """ return Order(typ='trial_period_days')
def interval(cls): """Creates and returns an interval Order :return: Order object """ return Order(typ='interval')
def email(cls): """Creates and returns an email Order :return: Order object """ return Order(typ='email')
def url(cls): """Creates and returns an url Order :return: Order object """ return Order(typ='url')