Example #1
0
    def test_signal_delete_orphan(self):

        owner = UserFactory()
        bankaccount = BankAccountFactory(owners=[owner])
        owner.delete()

        with self.assertRaises(BankAccount.DoesNotExist):
            bankaccount.refresh_from_db()
Example #2
0
    def test_signal_delete_not_orphan(self):

        owner = UserFactory()
        bankaccount = BankAccountFactory(owners=[owner, UserFactory()])
        owner.delete()

        bankaccount.refresh_from_db()
        self.assertTrue(bankaccount)
Example #3
0
    def test_delete_owner(self):

        owner = UserFactory(username='******')
        banktransactiontag = BankTransactionTagFactory(owner=owner)

        owner.delete()
        with self.assertRaises(BankTransactionTag.DoesNotExist):
            banktransactiontag.refresh_from_db()