Ejemplo n.º 1
0
 def test_profile_country_to_alpha3_invalid_country(self):
     """
     A profile with an invalid country code should raise an InvalidProfileDataException
     """
     with mute_signals(post_save):
         profile = ExamProfileFactory(profile__country='XXXX')
     with self.assertRaises(InvalidProfileDataException):
         CDDWriter.profile_country_to_alpha3(profile)
Ejemplo n.º 2
0
 def test_profile_phone_number_exceptions(self, bad_number):
     """
     It should raise exceptions for bad data
     """
     with mute_signals(post_save):
         profile = ExamProfileFactory(profile__phone_number=bad_number)
     with self.assertRaises(InvalidProfileDataException):
         CDDWriter.profile_phone_number_to_raw_number(profile)
     with self.assertRaises(InvalidProfileDataException):
         CDDWriter.profile_phone_number_to_country_code(profile)
Ejemplo n.º 3
0
 def test_last_name(self, unromanized, romanized, expected):
     """
     Test that the `last_name` method prefers the `romanized_last_name`
     field, and falls back on `last_name` field.
     """
     with mute_signals(post_save):
         profile = ExamProfileFactory(
             profile__last_name=unromanized,
             profile__romanized_last_name=romanized,
         )
     assert CDDWriter.last_name(profile) == expected
Ejemplo n.º 4
0
 def test_profile_phone_number_functions(self, input_number,
                                         expected_country_code,
                                         expected_number):
     """
     A profile with a valid phone number should be parsed correctly
     """
     with mute_signals(post_save):
         profile = ExamProfileFactory(profile__phone_number=input_number)
     assert CDDWriter.profile_phone_number_to_raw_number(
         profile) == expected_number
     assert CDDWriter.profile_phone_number_to_country_code(
         profile) == expected_country_code
Ejemplo n.º 5
0
 def test_profile_state(self, country, state, expected):
     """Test that profile_state returns expected values"""
     with mute_signals(post_save):
         profile = ExamProfileFactory(profile__country=country,
                                      profile__state_or_territory=state)
     assert CDDWriter.profile_state(profile) == expected