def test_signal_delete_orphan(self): owner = UserFactory() bankaccount = BankAccountFactory(owners=[owner]) owner.delete() with self.assertRaises(BankAccount.DoesNotExist): bankaccount.refresh_from_db()
def test_signal_delete_not_orphan(self): owner = UserFactory() bankaccount = BankAccountFactory(owners=[owner, UserFactory()]) owner.delete() bankaccount.refresh_from_db() self.assertTrue(bankaccount)
def test_delete_owner(self): owner = UserFactory(username='******') banktransactiontag = BankTransactionTagFactory(owner=owner) owner.delete() with self.assertRaises(BankTransactionTag.DoesNotExist): banktransactiontag.refresh_from_db()