Exemple #1
0
 def test_get_firm_users_filter(self):
     url = reverse('firm:analytics') + '?users=' + str(
         self.betasmartz_client.user.pk) + '&worth=&risk=40'
     rep = AuthorisedRepresentativeFactory.create()
     self.client.login(username=rep.user.email, password='******')
     response = self.client.get(url)
     self.assertEqual(response.status_code, status.HTTP_200_OK)
Exemple #2
0
 def test_get_firm_analytics_client_filter(self):
     """
       Test get request to firm analytics with risk filter
     """
     url = reverse('firm:analytics') + '?worth=high&advisor=&client='
     rep = AuthorisedRepresentativeFactory.create()
     self.client.login(username=rep.user.email, password='******')
     response = self.client.get(url)
     self.assertEqual(response.status_code, status.HTTP_200_OK)
Exemple #3
0
 def test_get_firm_analytics(self):
     """
     Test get request to firm analytics page
     """
     url = reverse('firm:analytics')
     rep = AuthorisedRepresentativeFactory.create()
     self.client.login(username=rep.user.email, password='******')
     response = self.client.get(url)
     self.assertEqual(response.status_code, status.HTTP_200_OK)
    def test_get_firm_analytics_worth_and_risk_filter(self):
        # /firm/analytics?worth=affluent&risk=0&risk=20&advisor=&client=
        url = reverse('firm:analytics') + '?worth=affluent&risk=0&risk=20&advisor=&client='
        rep = AuthorisedRepresentativeFactory.create(firm=self.firm)
        advisor = AdvisorFactory.create(firm=self.firm)
        aclient = ClientFactory.create(advisor=advisor)
        aaccount = ClientAccountFactory.create(primary_owner=aclient)
        goal = GoalFactory.create(account=aaccount)

        self.client.login(username=rep.user.email, password='******')
        response = self.client.get(url)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
    def setUp(self):
        self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
        self.account = ClientAccountFactory.create()

        self.advisor = self.account.primary_owner.advisor
        self.firm = self.advisor.firm
        self.advisor2 = AdvisorFactory.create(firm=self.firm)
        self.betasmartz_client2 = ClientFactory.create(advisor=self.advisor2)
        self.account2 = ClientAccountFactory.create(
            primary_owner=self.betasmartz_client2)
        self.account_group = AccountGroupFactory.create(advisor=self.advisor)
        self.account_group2 = AccountGroupFactory.create(advisor=self.advisor2)
        self.account.account_group = self.account_group
        self.account.save()
        self.account2.account_group = self.account_group2
        self.account2.save()
        self.rep = AuthorisedRepresentativeFactory.create(firm=self.firm)
    def test_delete_supervisor_get(self):
        supervisor = SupervisorFactory.create()
        rep = AuthorisedRepresentativeFactory.create(firm=supervisor.firm)
        url = '/firm/supervisors/{}/delete'.format(supervisor.id)
        # unauthenticated
        response = self.client.get(url)
        # redirects to login
        self.assertEqual(
            response.status_code,
            status.HTTP_302_FOUND,
            msg='Unauthenticated get request to get supervisor delete view')

        # authenticated
        self.client.login(username=rep.user.email, password='******')
        response = self.client.get(url)
        self.assertEqual(response.status_code,
                         status.HTTP_200_OK,
                         msg='Valid get request to delete view for supervisor')
Exemple #7
0
    def test_create_supervisor(self):
        url = '/firm/supervisors/create'
        rep = AuthorisedRepresentativeFactory.create(firm=self.firm)

        data = {
            'email': '*****@*****.**',
            'first_name': 'Bruce',
            'middle_name': 'Alfred',
            'last_name': 'Wayne',
            'password': '******',
            'confirm_password': '******',
            'can_write': True,
            'betasmartz_agreement': True,
        }

        self.client.login(username=rep.user.email, password='******')
        response = self.client.post(url, data)
        self.assertRedirects(response, '/firm/supervisors')
    def test_delete_supervisor_post(self):
        num_of_supervisors = Supervisor.objects.count()
        supervisor = SupervisorFactory.create()
        self.assertEqual(Supervisor.objects.count(), num_of_supervisors + 1)
        rep = AuthorisedRepresentativeFactory.create(firm=supervisor.firm)
        url = '/firm/supervisors/{}/delete'.format(supervisor.id)

        # unauthenticated
        response = self.client.post(url)
        # redirects to login
        self.assertEqual(
            response.status_code,
            status.HTTP_302_FOUND,
            msg='Unauthenticated post request to supervisor delete view')

        self.client.login(username=rep.user.email, password='******')
        response = self.client.post(url, follow=True)
        self.assertEqual(response.status_code,
                         status.HTTP_200_OK,
                         msg='Valid post request to supervisor delete view')

        self.assertEqual(Supervisor.objects.count(), num_of_supervisors)