示例#1
0
def _create_attribution(learning_unit_year, person, is_score_responsible=False):
    PersonAddressFactory(person=person, label='PROFESSIONAL', city="Louvain-la-neuve")
    PersonAddressFactory(person=person, label='PRIVATE', city="Bruxelles")
    return AttributionFactory(
        learning_unit_year=learning_unit_year,
        tutor=TutorFactory(person=person),
        score_responsible=is_score_responsible
    )
示例#2
0
def _create_attribution(learning_unit_year,
                        person,
                        is_score_responsible=False):
    # Create tutor
    tutor = TutorFactory(person=person)
    # Create two address [One private - One Professional]
    PersonAddressFactory(person=person,
                         label='PROFESSIONAL',
                         city="Louvain-la-neuve")
    PersonAddressFactory(person=person, label='PRIVATE', city="Bruxelles")
    return AttributionFactory(learning_unit_year=learning_unit_year,
                              tutor=tutor,
                              score_responsible=is_score_responsible)
示例#3
0
 def setUp(self):
     self.a_user = user.UserFactory(username="******")
     self.a_person = PersonFactory(user=self.a_user,
                                   language="fr-be",
                                   first_name="John",
                                   last_name="Doe")
     self.address = PersonAddressFactory(person=self.a_person)
示例#4
0
 def test_person_exists(self):
     person = PersonFactory(source=person_source_type.BASE)
     person_address = PersonAddressFactory(person=person)
     url = reverse('person_exists', kwargs={'cohort_id': self.cohort.pk})
     response = self.client.post(url,
                                 data=json.dumps({'email': person.email}),
                                 content_type='application/json')
     person_with_address_dict = {
         'birth_date': person.birth_date,
         'city': person_address.city,
         'country': person_address.country.pk,
         'email': person.email,
         'first_name': person.first_name,
         'gender': person.gender,
         'id': person.pk,
         'last_name': person.last_name,
         'location': person_address.location,
         'person': person.pk,
         'phone': person.phone,
         'postal_code': person_address.postal_code,
         'source': person.source,
     }
     response_dict = json.loads(response.content.decode('utf-8'))
     for key, value in person_with_address_dict.items():
         self.assertEqual(value, response_dict[key])
 def test_fields_disabled_for_other_instance_sources(self):
     person_address = PersonAddressFactory(person__source=BASE)
     form = InternshipPersonAddressForm(instance=person_address)
     for field in form.fields.values():
         self.assertTrue(field.disabled)
 def test_fields_enabled_for_instance_with_internship_source(self):
     person_address = PersonAddressFactory(person__source=INTERNSHIP)
     form = InternshipPersonAddressForm(instance=person_address)
     for field in form.fields.values():
         self.assertFalse(field.disabled)
示例#7
0
 def setUpTestData(cls):
     cls.a_user = user.UserFactory(username="******")
     cls.a_person = PersonFactory(user=cls.a_user, language="fr-be", first_name="John", last_name="Doe")
     cls.address = PersonAddressFactory(person=cls.a_person)