def create_factories(self): super().create_factories() self.team_account = AccountFactory.create(type='ASSET', name='Team Network') self.team_account.patterns = [ AccountPattern(pattern=r"2[0-9]{3}-N\d\d") ] self.bank_account = BankAccountFactory.create() self.activity, *rest = (BankAccountActivityFactory.create( bank_account=self.bank_account, reference=reference) for reference in [ 'Erstattung 2020-N15 (Pizza)', 'Erstattung 2020-NN', 'Other reference, which should not match our regex', ])
def test_should_not_delete_related_goal(self): account = AccountFactory.create() GoalFactory(accounts=[account], user=account.user) account.delete() self.assertEqual(Goal.query.count(), 1) self.assertEqual(Account.query.count(), 0)
def test_should_delete_accounts_belonging_to_it(self): institution = AccountFactory.create().institution institution.delete() self.assertEqual(Institution.query.count(), 0) self.assertEqual(Account.query.count(), 0)
def test_should_delete_accounts(self): user = AccountFactory.create().user user.delete() self.assertEqual(User.query.count(), 0) self.assertEqual(Account.query.count(), 0)