Пример #1
0
    def test_calculate_summary_may_do_it_properly(self):
        user = UserFactory()
        TransactionFactory.create_batch(5, user=user)

        summary = TransactionService.calculate_summary(user.id)

        self.assertIsInstance(summary, dict)
        self.assertIn('inflow', summary)
        self.assertIsInstance(summary['inflow'], dict)
        self.assertIn('outflow', summary)
        self.assertIsInstance(summary['outflow'], dict)
Пример #2
0
 def summary(self, request, user_id: str):
     processed_transactions = TransactionService.calculate_summary(user_id)
     return Response(processed_transactions)