Esempio n. 1
0
 def test_get_goal_types(self):
     Fixture1.goal_type1()
     url = '/api/v1/settings/goal-types'
     self.client.force_authenticate(user=Fixture1.client1().user)
     response = self.client.get(url)
     self.assertEqual(len(response.data), 1)
     self.assertEqual(response.data[0]['name'], 'goaltype1')
     self.assertFalse(
         'risk_sensitivity'
         in response.data[0])  # We should not make public our risk model.
Esempio n. 2
0
    def test_account_must_be_confirmed(self):
        account = Fixture1.personal_account1()
        account.confirmed = False
        account.save()
        self.assertFalse(account.confirmed)

        with self.assertRaises(ValidationError) as e:
            goal = Goal.objects.create(account=Fixture1.personal_account1(),
                                       name='goal1',
                                       type=Fixture1.goal_type1(),
                                       portfolio_set=Fixture1.portfolioset1(),
                                       selected_settings=Fixture1.settings1())
Esempio n. 3
0
    def test_all_settings(self):
        # Populate a goal type
        gt = Fixture1.goal_type1()

        # Populate all of the account mappings
        m1 = AccountTypeRiskProfileGroup.objects.create(
            account_type=ACCOUNT_TYPE_PERSONAL,
            risk_profile_group=Fixture1.risk_profile_group1())
        m2 = AccountTypeRiskProfileGroup.objects.create(
            account_type=ACCOUNT_TYPE_JOINT,
            risk_profile_group=Fixture1.risk_profile_group1())
        m3 = AccountTypeRiskProfileGroup.objects.create(
            account_type=ACCOUNT_TYPE_CORPORATE,
            risk_profile_group=Fixture1.risk_profile_group1())
        m4 = AccountTypeRiskProfileGroup.objects.create(
            account_type=ACCOUNT_TYPE_SMSF,
            risk_profile_group=Fixture1.risk_profile_group1())
        m5 = AccountTypeRiskProfileGroup.objects.create(
            account_type=ACCOUNT_TYPE_TRUST,
            risk_profile_group=Fixture1.risk_profile_group1())

        url = '/api/v1/settings'
        self.client.force_authenticate(user=Fixture1.client1().user)
        response = self.client.get(url)
        self.assertEqual(response.status_code, status.HTTP_200_OK)

        # Make sure the goal types are there
        self.assertEqual(len(response.data['goal_types']), 1)
        self.assertEqual(response.data['goal_types'][0]['name'], 'goaltype1')

        # Make sure the civil_statuses are there
        self.assertTrue('civil_statuses' in response.data)
        self.assertEqual(set(('id', 'name')),
                         set(response.data['civil_statuses'][0].keys()))

        # Make sure the employment_statuses are there
        self.assertTrue('employment_statuses' in response.data)
        self.assertEqual(set(('id', 'name')),
                         set(response.data['employment_statuses'][0].keys()))

        # Make sure the external_asset_types are there
        self.assertTrue('external_asset_types' in response.data)
        self.assertEqual(set(('id', 'name')),
                         set(response.data['external_asset_types'][0].keys()))