Esempio n. 1
0
 def setUp(self):
     active_client = ActiveClientMainFactory(
         birthday=datetime.datetime(1977, 1, 1))
     financial_planning = FinancialPlanningFactory(
         active_client=active_client)
     self.goal_manager = financial_planning.goal_manager
     goal_type1 = GoalTypeFactory(name='Imóvel')
     goal_type2 = GoalTypeFactory(name='Vestuário')
     self.goal_has_end_date = GoalFactory(has_end_date=False,
                                          goal_type=goal_type1,
                                          year_init=2021,
                                          periodicity=3,
                                          value=50000,
                                          goal_manager=self.goal_manager)
     self.goal_hasnt_end_date = GoalFactory(has_end_date=True,
                                            goal_type=goal_type2,
                                            year_init=2021,
                                            periodicity=3,
                                            value=50000,
                                            year_end=2031,
                                            goal_manager=self.goal_manager)
     self.array_flow_withot_date = [
         0, 0, 0, 0, 50000, 0, 0, 50000, 0, 0, 50000, 0, 0, 50000, 0, 0,
         50000, 0, 0, 50000
     ]
     self.array_flow_with_date = [
         0, 0, 0, 0, 50000, 0, 0, 50000, 0, 0, 50000, 0, 0, 50000, 0, 0, 0,
         0, 0, 0
     ]
Esempio n. 2
0
 def setUp(self):
     self.cost_manager = CostManagerFactory()
     active_client = ActiveClientMainFactory(
         birthday=datetime.datetime(1967, 1, 1))
     self.patrimony = PatrimonyMainFactory()
     self.patrimony.incomes.all().update(value_monthly=55000,
                                         thirteenth=False,
                                         vacation=False)
     ActiveFactory(value=30000.00,
                   active_manager=self.patrimony.activemanager)
     ActiveFactory(value=321200.00,
                   active_manager=self.patrimony.activemanager)
     ArrearageFactory(patrimony=self.patrimony, value=351200.00)
     self.goal_manager = GoalManagerFactory()
     GoalFactory.create_batch(4,
                              goal_manager=self.goal_manager,
                              year_init=2017,
                              year_end=2027,
                              value=2500,
                              periodicity=1)
     self.financial_independece = FinancialIndependenceFactory(
         duration_of_usufruct=35,
         remain_patrimony=30000,
     )
     self.financial_planning = FinancialPlanningFactory(
         active_client=active_client,
         cost_manager=self.cost_manager,
         patrimony=self.patrimony,
         financial_independence=self.financial_independece,
         goal_manager=self.goal_manager,
         target_profitability=110,
     )
Esempio n. 3
0
    def setUp(self):
        self.employee = EmployeeMainFactory()
        self.financial_adviser = FinancialAdviserMainFactory()
        self.active_client = ActiveClientMainFactory()
        self.client_test = ClientTest()

        jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
        jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER

        payload = jwt_payload_handler(self.employee)
        self.token = jwt_encode_handler(payload)
Esempio n. 4
0
    def test_not_save_active_client_with_repeated_cpf(self):
        active_client = ActiveClientMainFactory()
        active_client = ActiveClient.objects.last()

        active_client2 = ActiveClientMainFactory()
        active_client2 = ActiveClient.objects.last()
        active_client2.cpf = active_client.cpf

        with self.assertRaises(ValidationError):
            active_client2.save()
Esempio n. 5
0
 def setUp(self):
     active_client = ActiveClientMainFactory(
         birthday=datetime.datetime(1967, 1, 1))
     self.patrimony = PatrimonyMainFactory()
     self.patrimony.incomes.all().update(value_monthly=1212.2)
     FinancialPlanningFactory(
         active_client=active_client,
         patrimony=self.patrimony)
     self.common_income = IncomeFactory(value_monthly=round(1200, 2),
                                        thirteenth=False,
                                        patrimony=self.patrimony,
                                        vacation=False)
     self.income_with_thirteenth = IncomeFactory(value_monthly=1200.00,
                                                 thirteenth=True,
                                                 patrimony=self.patrimony,
                                                 vacation=False)
     self.income_with_vacation = IncomeFactory(value_monthly=round(1200, 2),
                                               thirteenth=False,
                                               patrimony=self.patrimony,
                                               vacation=True)
Esempio n. 6
0
 def setUp(self):
     self.active_client = ActiveClientMainFactory()
     self.user = User.objects.last()
Esempio n. 7
0
 def test_not_save_active_client_with_account_number_wrong(self):
     self.active_client = ActiveClientMainFactory()
     bank_account = BankAccount.objects.last()
     bank_account.account = "1212-1"
     with self.assertRaises(ValidationError):
         bank_account.save()
Esempio n. 8
0
 def test_save_active_client_with_account_number_right(self):
     self.active_client = ActiveClientMainFactory()
     bank_account = BankAccount.objects.last()
     bank_account.account = "12121-1"
     bank_account.save()
     self.assertEqual(BankAccount.objects.last(), bank_account)
Esempio n. 9
0
 def test_not_save_active_client_with_phone_number_wrong(self):
     self.active_client = ActiveClientMainFactory()
     active_client = ActiveClient.objects.last()
     active_client.telephone = "9999-9999"
     with self.assertRaises(ValidationError):
         active_client.save()
Esempio n. 10
0
 def test_save_active_client_with_phone_number_right(self):
     self.active_client = ActiveClientMainFactory()
     active_client = ActiveClient.objects.last()
     active_client.telephone = "(61) 9999-9999"
     active_client.save()
     self.assertEqual(ActiveClient.objects.last(), active_client)
Esempio n. 11
0
 def test_not_save_active_client_with_cpf_wrong(self):
     self.active_client = ActiveClientMainFactory()
     active_client = ActiveClient.objects.last()
     active_client.cpf = "12345678901"
     with self.assertRaises(ValidationError):
         active_client.save()
Esempio n. 12
0
 def test_save_active_client_with_cpf_right(self):
     self.active_client = ActiveClientMainFactory()
     active_client = ActiveClient.objects.last()
     active_client.cpf = "85726391012"
     active_client.save()
     self.assertEqual(ActiveClient.objects.last(), active_client)
Esempio n. 13
0
 def setUp(self):
     self.active_client = ActiveClientMainFactory.build()
     self.client = ClientFactory.build()