def test_suffix_lookup(self):
    number1 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999123', verified=True, pending_verification=False, is_two_way=True)
    number2 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999223', verified=True, pending_verification=False, is_two_way=True)
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('1 23'), number1)
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('2 23'), number2)
    self.assertIsNone(PhoneNumber.get_two_way_number_by_suffix('23'))
    number1.phone_number = '999124'
    number1.save()
    number2.phone_number = '999224'
    number2.save()
    self.assertIsNone(PhoneNumber.get_two_way_number_by_suffix('1 23'))
    self.assertIsNone(PhoneNumber.get_two_way_number_by_suffix('2 23'))
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('124'), number1)
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('224'), number2)
def test_suffix_lookup(self):
    number1 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999123', verified=True, pending_verification=False, is_two_way=True)
    number2 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999223', verified=True, pending_verification=False, is_two_way=True)
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('1 23'), number1)
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('2 23'), number2)
    self.assertIsNone(PhoneNumber.get_two_way_number_by_suffix('23'))
    number1.phone_number = '999124'
    number1.save()
    number2.phone_number = '999224'
    number2.save()
    self.assertIsNone(PhoneNumber.get_two_way_number_by_suffix('1 23'))
    self.assertIsNone(PhoneNumber.get_two_way_number_by_suffix('2 23'))
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('124'), number1)
    self.assertEqual(PhoneNumber.get_two_way_number_by_suffix('224'), number2)