def test_subvention_deleted(self): from accounting_tools.models import Subvention Subvention(id=2, name='bad subvention', amount_asked=456, kind='subvention', linked_budget_id=1, accounting_year_id=1, unit_id=1, deleted=True).save() self.call_check_html('/accounting/tools/subvention/deleted', data={'upk':1}) self.call_check_redirect('/accounting/tools/subvention/deleted', method='post', data={'upk':1, 'pk':2}, redirect_url='/accounting/tools/subvention/')
def setup_testing_accounting_tools(user): from accounting_tools.models import Withdrawal, InternalTransfer, FinancialProvider, Subvention, SubventionFile from accounting_tools.models import ProviderInvoice, Invoice, CashBook, CashBookLine, ExpenseClaim, ExpenseClaimLine, ExpenseClaimLogging now = timezone.now() Withdrawal(id=1, name='reason', user=user, amount=12.34, desired_date=now, withdrawn_date=None, accounting_year_id=1, costcenter_id=1).save() InternalTransfer(id=1, name='reason', account_id=4, cost_center_from_id=1, cost_center_to_id=1, amount=98.76, transfert_date=now, accounting_year_id=1, status='3_archive').save() FinancialProvider( id=1, name='Financial name', tva_number='123456', iban_ou_ccp='ABCDEFG', bic='XYZ', address='Rue Des Arc en Ciel 25 - Case Postale 2, CH-1015 Lausanne' ).save() Subvention(id=1, name='Subvention', amount_asked=456, kind='subvention', linked_budget_id=1, accounting_year_id=1, unit_id=1).save() ProviderInvoice(id=1, name='Provider invoice', user=user, currency='EUR', provider_id=1, accounting_year_id=1, costcenter_id=1).save() Invoice(id=1, title='invoice', accounting_year_id=1, costcenter_id=1).save() CashBook(id=1, name='cash', user=user, nb_proofs=1, accounting_year_id=1, costcenter_id=1, status='6_archived').save() CashBookLine(cashbook_id=1, date=now, helper='2_sell', label='sell', account_id=2, value=123, tva=0, value_ttc=123).save() CashBookLine(cashbook_id=1, date=now, helper='1_deposit', label='deposit', account_id=7, value=123, tva=0, value_ttc=123).save() ExpenseClaim(id=1, name='expense', user=user, nb_proofs=1, accounting_year_id=1, costcenter_id=1, status='6_archived').save() ExpenseClaimLine(expense_claim_id=1, label='claim', account_id=5, value=54.65, tva=0, value_ttc=54.65).save() ExpenseClaimLogging(object_id=1, when=now, who=user, what='created').save() media_path = join(dirname(dirname(__file__)), 'media') copyfile(join(media_path, 'img/logo_testing.png'), join(media_path, 'uploads/files/logo_testing.png')) copyfile(join(media_path, 'sound', 'bigbox.mp3'), join(media_path, 'uploads/files/bigbox.mp3')) SubventionFile(id=1, uploader_id=1, file='uploads/files/logo_testing.png').save()