Exemplo n.º 1
0
 def test_patient_creation_without_country_code(self):
     """ Test patients missing country code are still inserted """
     node = self.create_xml_patient({'Mobile_Number': '2223334444'})
     payload = self.create_payload([node])
     with patch_settings(COUNTRY_CODE='66', INTERNATIONAL_DIALLING_CODE='+'):
         parse_patient(node, payload)
         patients = reminders.Patient.objects.all()
         self.assertEqual(patients[0].mobile_number, '+662223334444')
Exemplo n.º 2
0
 def test_normalize_number(self):
     """
     All numbers should be stripped of non-numeric characters and, if
     defined, should be prepended with the COUNTRY_CODE
     """
     normalized = '+12223334444'
     number = '1-222-333-4444'
     self.assertEqual(self.app._normalize_number(number), normalized)
     number = '1 (222) 333-4444'
     self.assertEqual(self.app._normalize_number(number), normalized)
     with patch_settings(COUNTRY_CODE='66', INTERNATIONAL_DIALLING_CODE='+'):
         normalized = '+662223334444'
         number = '22-23334444'
         self.assertEqual(self.app._normalize_number(number), normalized)
     with patch_settings(COUNTRY_CODE=None):
         normalized = '2223334444'
         number = '22-23334444'
         self.assertEqual(self.app._normalize_number(number), normalized)
Exemplo n.º 3
0
 def test_normalize_number(self):
     """
     All numbers should be stripped of non-numeric characters and, if
     defined, should be prepended with the COUNTRY_CODE
     """
     normalized = "12223334444"
     number = "1-222-333-4444"
     self.assertEqual(self.app._normalize_number(number), normalized)
     number = "1 (222) 333-4444"
     self.assertEqual(self.app._normalize_number(number), normalized)
     with patch_settings(COUNTRY_CODE="66"):
         normalized = "662223334444"
         number = "22-23334444"
         self.assertEqual(self.app._normalize_number(number), normalized)
     with patch_settings(COUNTRY_CODE=None):
         normalized = "2223334444"
         number = "22-23334444"
         self.assertEqual(self.app._normalize_number(number), normalized)