Exemplo n.º 1
0
 def setUp(self):
     self.user = TestUsers.new_user(username='******', password='******')
     self.school = TestSchools.new_school(user=self.user)
     self.country = TestCountries.new_country()
     self.committee1 = TestCommittees.new_committee()
     self.committee2 = TestCommittees.new_committee()
     self.assignment1 = TestAssignments.new_assignment(
         committee=self.committee1,
         country=self.country,
         school=self.school,
     )
     self.assignment2 = TestAssignments.new_assignment(
         committee=self.committee2,
         country=self.country,
         school=self.school,
     )
     self.delegate1 = TestDelegates.new_delegate(
         assignment=self.assignment1,
     )
     self.delegate2 = TestDelegates.new_delegate(
         assignment=self.assignment2,
         name='Trevor Dowds',
         email='*****@*****.**',
         summary='Good!'
     )
Exemplo n.º 2
0
    def setUp(self):
        self.user = TestUsers.new_user(username='******', password='******')
        self.school = TestSchools.new_school(user=self.user)

        self.country = TestCountries.new_country()
        self.committee1 = TestCommittees.new_committee()
        self.committee2 = TestCommittees.new_committee()
        self.committee3 = TestCommittees.new_committee()
        self.committee4 = TestCommittees.new_committee()

        self.assignment1 = TestAssignments.new_assignment(
            school=self.school,
            country=self.country,
            commitee=self.committee3
        )

        self.assignment2 = TestAssignments.new_assignment(
            school=self.school,
            country=self.country,
            committee=self.committee2
        )

        self.new_assignment = TestAssignments.new_assignment(
            school=self.school,
            country=self.country,
            committee=self.committee3
        )

        self.faulty_assignment = TestAssignments.new_assignment(
            country=self.country,
            committee=self.committee4
        )

        self.delegate1 = TestDelegates.new_delegate(
            name="Nathaniel Parke",
            school=self.school,
            assignment=self.assignment1
        )

        self.delegate2 = TestDelegates.new_delegate(
            name='Trevor Dowds',
            school=self.school,
            assignment=self.assignment2
        )

        self.params = [
            {'id': self.delegate1.id, 'assignment': self.new_assignment.id},
            {'id': self.delegate2.id, 'assignment': None}
        ]
Exemplo n.º 3
0
    def test_save(self):
        """
        A delegate's school field and a delegate's assignment's school field
        should be the same if they both exist on the delegate.
        """
        school = TestSchools.new_school(name='S1')
        assignment = TestAssignments.new_assignment()

        self.assertRaises(ValidationError, Delegate.objects.create,
            name="Test Delegate",
            school=school,
            assignment=assignment
        )
Exemplo n.º 4
0
    def test_update_assignment(self):
        '''Tests that when an assignment changes schools, its rejected
           field is set to False and any delegates assigned to it are
           no longer assigned to it.'''
        s1 = TestSchools.new_school(name='S1')
        s2 = TestSchools.new_school(name='S2')
        a = TestAssignments.new_assignment(school=s1, rejected=True)
        d1 = TestDelegates.new_delegate(school=s1, assignment=a)
        d2 = TestDelegates.new_delegate(school=s1, assignment=a)
        self.assertEquals(a.delegates.count(), 2)
        self.assertTrue(a.rejected)

        a.school = s2
        a.save()

        self.assertEquals(a.delegates.count(), 0)
        self.assertEquals(a.rejected, False)
Exemplo n.º 5
0
 def setUp(self):
     self.user = TestUsers.new_user(username='******', password='******')
     self.school = TestSchools.new_school(user=self.user)
     self.assignment = TestAssignments.new_assignment(school=self.school)
     self.delegate = TestDelegates.new_delegate(assignment=self.assignment)
     self.params['assignment'] = self.assignment.id
Exemplo n.º 6
0
 def setUp(self):
     self.user = TestUsers.new_user(username='******', password='******')
     self.school = TestSchools.new_school(user=self.user)
     self.assignment = TestAssignments.new_assignment(school=self.school)
Exemplo n.º 7
0
 def get_test_object(cls):
     return TestAssignments.new_assignment()
Exemplo n.º 8
0
 def get_test_object(cls):
     user = TestUsers.new_user(username="******", password="******")
     school = TestSchools.new_school(user=user)
     return TestAssignments.new_assignment(school=school)
Exemplo n.º 9
0
 def get_test_object(cls):
     user = TestUsers.new_user(username='******', password='******')
     school = TestSchools.new_school(user=user)
     assignment = TestAssignments.new_assignment(school=school)
     return TestDelegates.new_delegate(assignment=assignment)
Exemplo n.º 10
0
 def setUp(self):
     self.user = TestUsers.new_user(username='******', password='******')
     self.school = TestSchools.new_school(user=self.user)
     self.assignment = TestAssignments.new_assignment(school=self.school)
     self.delegate = TestDelegates.new_delegate(assignment=self.assignment)
     self.params['assignment'] = self.assignment.id
Exemplo n.º 11
0
 def setUp(self):
     self.user = TestUsers.new_user(username='******', password='******')
     self.school = TestSchools.new_school(user=self.user)
     self.assignment = TestAssignments.new_assignment(school=self.school)