def test_update_payment(self):
     self.payment1.save()
     payment1 = Payment.get(id=1)
     payment1.update({'balance': 1000.0, 'required': 5000.0})
     payment1 = Payment.get(id=1)
     self.assertEqual(1000.0, payment1.balance)
     self.assertEqual(5000.0, payment1.required)
     self.assertTrue(isinstance(
         payment1.update({'random': 'bad field'}), dict))
 def test_add_and_remove_payments_from_wallet(self):
     self.wallet1.save()
     self.payment1.save()
     self.payment2.save()
     wallet1 = Wallet.get(id=1)
     self.assertEqual(0, len(wallet1.payments))
     wallet1.insert('payments', [Payment.get(id=1), Payment.get(id=2)])
     wallet1 = Wallet.get(id=1)
     self.assertEqual(True, isinstance(wallet1.payments[0], Payment))
     self.assertEqual(True, isinstance(wallet1.payments[1], Payment))
     self.assertEqual(2, len(wallet1.payments))
     wallet1.remove('payments', id=1)
     self.assertEqual(1, len(wallet1.payments))
 def test_add_and_remove_deposit_estate_unit_wallet(self):
     self.deposit1.save()
     self.deposit2.save()
     self.estate1.save()
     self.unit1.save()
     self.wallet1.save()
     self.payment1.save()
     payment1 = Payment.get(id=1)
     payment1.estate = Estate.get(id=1)
     payment1.unit = Unit.get(id=1)
     payment1.wallet = Wallet.get(id=1)
     payment1.insert('deposits', [Deposit.get(id=1), Deposit.get(id=2)])
     self.assertEqual(True, isinstance(payment1.estate, Estate))
     self.assertEqual(True, isinstance(payment1.unit, Unit))
     self.assertEqual(True, isinstance(payment1.wallet, Wallet))
     self.assertEqual(True, isinstance(payment1.deposits[0], Deposit))
     self.assertEqual(True, isinstance(payment1.deposits[1], Deposit))
     self.assertEqual(2, len(payment1.deposits))
     payment1.remove('estate')
     payment1.remove('unit')
     payment1.remove('wallet')
     self.assertEqual(None, payment1.estate)
     self.assertEqual(None, payment1.unit)
     self.assertEqual(None, payment1.wallet)
     payment1.remove('deposits', id=1)
     self.assertEqual(1, len(payment1.deposits))
 def test_get_many_payments(self):
     self.assertEqual(True, isinstance(Payment.get(id=1), dict))
     self.payment1.save()
     self.payment2.save()
     self.assertEqual(True, isinstance(Payment.get_all()[0], Payment))
     self.assertEqual(True, isinstance(Payment.get_all()[1], Payment))
     self.assertEqual(2, len(Payment.get_all()))
 def test_add_and_remove_payment_to_deposit(self):
     self.deposit1.save()
     self.payment1.save()
     deposit1 = Deposit.get(id=1)
     self.assertEqual(None, deposit1.payment)
     deposit1.insert('payment', Payment.get(id=1))
     self.assertEqual(True, isinstance(deposit1.payment, Payment))
     deposit1.remove('payment')
     self.assertEqual(None, deposit1.payment)
Beispiel #6
0
 def test_add_and_remove_payment_from_unit(self):
     self.unit1.save()
     self.payment1.save()
     unit1 = Unit.get(id=1)
     self.assertEqual(None, unit1.payment)
     payment1 = Payment.get(id=1)
     unit1.insert('payment', payment1)
     unit1 = Unit.get(id=1)
     self.assertEqual(True, isinstance(unit1.payment, Payment))
     unit1.remove('payment')
     self.assertEqual(None, unit1.payment)
 def test_add_and_remove_payment_to_estate(self):
     self.estate1.save()
     self.payment1.save()
     estate1 = Estate.get(id=1)
     self.assertEqual(None, estate1.payment)
     payment1 = Payment.get(id=1)
     estate1.insert('payment', payment1)
     estate1 = Estate.get(id=1)
     self.assertEqual(True, isinstance(estate1.payment, Payment))
     estate1.remove('payment')
     self.assertEqual(None, estate1.payment)
 def test_delete_payment(self):
     self.payment1.save()
     self.assertTrue(Payment.check_exists(id=1))
     payment1 = Payment.get(id=1)
     self.assertTrue(payment1.delete())
     self.assertFalse(Payment.check_exists(id=1))
 def test_get_payment(self):
     self.assertEqual(True, isinstance(Payment.get(id=1), dict))
     self.payment1.save()
     self.assertEqual(True, isinstance(Payment.get(id=1), Payment))