Esempio n. 1
0
class ProjectSupervisorApproveFormTests(TestCase):

    fixtures = [
        'institution/fixtures/tests/institutions.json',
        'users/fixtures/tests/users.json',
        'funding/fixtures/tests/funding_bodies.json',
        'funding/fixtures/tests/attributions.json',
        'project/fixtures/tests/categories.json',
        'project/fixtures/tests/projects.json',
        'project/fixtures/tests/memberships.json',
    ]

    def setUp(self):
        self.project = Project.objects.get(code='scw0000')
        self.user = CustomUser.objects.get(email=self.project.supervisor_email)
        self.data = {
            'approved_by_supervisor': True,
        }

    def test_project_supervisor_form_validation(self):
        self.form = ProjectSupervisorApproveForm(
            self.user, instance=self.project, data=self.data
        )
        self.assertTrue(self.form.is_valid())

    def test_project_supervisor_form_incorrect_email(self):
        user = CustomUser.objects.get(email='*****@*****.**')
        self.form = ProjectSupervisorApproveForm(
            user, instance=self.project, data=self.data
        )
        self.assertFalse(self.form.is_valid())
Esempio n. 2
0
 def test_project_supervisor_form_incorrect_email(self):
     user = CustomUser.objects.get(email='*****@*****.**')
     self.form = ProjectSupervisorApproveForm(
         user, instance=self.project, data=self.data
     )
     self.assertFalse(self.form.is_valid())
Esempio n. 3
0
 def test_project_supervisor_form_validation(self):
     self.form = ProjectSupervisorApproveForm(
         self.user, instance=self.project, data=self.data
     )
     self.assertTrue(self.form.is_valid())
Esempio n. 4
0
 def get_form(self, form_class=None):
     return ProjectSupervisorApproveForm(self.request.user,
                                         **self.get_form_kwargs())