Exemplo n.º 1
0
    def test_grant_application_counts(self, *mocks):
        company = CompanyFactory()

        # Create 2 approved grant applications for this company
        GrantManagementProcessFactory.create_batch(
            size=2,
            grant_application__company=company,
            decision=GrantManagementProcess.Decision.APPROVED
        )
        # Create 1 rejected grant application for this company
        GrantManagementProcessFactory(
            grant_application__company=company,
            decision=GrantManagementProcess.Decision.REJECTED
        )
        # Create a grant application which is currently under review
        GrantManagementProcessFactory(grant_application__company=company)

        # Create a new grant application
        ga = GrantApplicationFactory(company=company)
        path = reverse('grant-applications:grant-applications-detail', args=(ga.id,))

        response = self.client.get(path)
        self.assertEqual(response.data['company']['previous_applications'], 2)
        self.assertEqual(response.data['company']['applications_in_review'], 1)
Exemplo n.º 2
0
 def test_grant_application_is_not_eligible_with_high_turnover(self, *mocks):
     ga = GrantApplicationFactory(is_turnover_greater_than=True)
     self.assertFalse(ga.is_eligible)
Exemplo n.º 3
0
 def test_grant_application_is_not_eligible_with_number_of_employees(self, *mocks):
     ga = GrantApplicationFactory(
         number_of_employees=GrantApplication.NumberOfEmployees.HAS_250_OR_MORE
     )
     self.assertFalse(ga.is_eligible)
Exemplo n.º 4
0
 def test_grant_application_is_not_eligible_if_already_committed(self, *mocks):
     ga = GrantApplicationFactory(is_already_committed_to_event=True)
     self.assertFalse(ga.is_eligible)
Exemplo n.º 5
0
 def test_grant_application_is_not_eligible_with_6_previous_applications(self, *mocks):
     ga = GrantApplicationFactory(previous_applications=6)
     self.assertFalse(ga.is_eligible)
Exemplo n.º 6
0
 def test_new_grant_application_is_eligible(self, *mocks):
     ga = GrantApplicationFactory()
     self.assertTrue(ga.is_eligible)
Exemplo n.º 7
0
 def test_send_for_review_starts_flow_process(self, *mocks):
     ga = GrantApplicationFactory()
     ga.send_for_review()
     self.assertTrue(hasattr(ga, 'grant_management_process'))
     self.assertTrue(ga.sent_for_review)
Exemplo n.º 8
0
 def test_new_grant_application_sent_for_review_is_false(self, *mocks):
     ga = GrantApplicationFactory()
     self.assertFalse(ga.sent_for_review)