def test_invoice_on_unpayment_invoice_task( self, unpayment_task_builder_function): self.invoice.invoice_ok = True self.invoice.save() create_invoice_affect_set(self.invoice) calculate_super_user_task() unpayment_task_builder_function.assert_called_once_with(self.invoice)
def test_invoice_on_to_complete_invoice_task( self, invoices_to_complete_builder_function, unpayment_task_builder_function): self.invoice.invoice_ok = True self.invoice.save() create_invoice_affect_set(self.invoice, total_amount=True) calculate_super_user_task() invoices_to_complete_builder_function.assert_called_once_with( self.invoice) self.assertFalse(unpayment_task_builder_function.called)
def events_home(request): user = request.user tasks = [] if Organizer.objects.filter(user=user).exists(): tasks = calculate_organizer_task(user) else: if user.is_superuser: tasks = calculate_super_user_task() return render(request, 'events_home.html', {'tasks': tasks})
def test_providerexpense_cancelled(self, provider_payment_unfinish_task_builder): create_provider_expense(cancelled_date=timezone.now()) calculate_super_user_task() provider_payment_unfinish_task_builder.assert_not_called()
def test_providerexpense_paid(self, provider_payment_unfinish_task_builder): create_provider_expense(payment=Payment.objects.create(document='testdoc')) calculate_super_user_task() provider_payment_unfinish_task_builder.assert_not_called()
def test_providerexpense_no_payment(self, provider_payment_unfinish_task_builder): expense = create_provider_expense() calculate_super_user_task() provider_payment_unfinish_task_builder.assert_called_with(expense)
def test_not_enabled_sponsors_called(self, not_enabled_sponsor_function): calculate_super_user_task() sponsors = Sponsor.objects.filter(enabled=False) for sponsor in sponsors: not_enabled_sponsor_function.assert_called_with(sponsor)