@run_with_all_backends
def test_phone_number_already_in_use(self):
    self.assertEqual(PhoneNumber.count_by_domain(self.domain), 0)
    with create_test_case(self.domain, 'participant', 'test1', drop_signals=False) as case1, create_test_case(self.domain, 'participant', 'test2', drop_signals=False) as case2:
        case1 = self.set_case_property(case1, 'contact_phone_number', '99987658765')
        case1 = self.set_case_property(case1, 'contact_phone_number_is_verified', '1')
        case2 = self.set_case_property(case2, 'contact_phone_number', '99987698769')
        case2 = self.set_case_property(case2, 'contact_phone_number_is_verified', '1')
        self.assertIsNotNone(self.get_case_phone_number(case1))
        self.assertIsNotNone(self.get_case_phone_number(case2))
        self.assertEqual(PhoneNumber.count_by_domain(self.domain), 2)
        case2 = self.set_case_property(case2, 'contact_phone_number', '99987658765')
        self.assertIsNotNone(self.get_case_phone_number(case1))
        self.assertIsNotNone(self.get_case_phone_number(case2))
        self.assertEqual(PhoneNumber.count_by_domain(self.domain), 2)
        self.assertPhoneNumberDetails(case1, '99987658765', None, None, True, False, True)
        self.assertPhoneNumberDetails(case2, '99987658765', None, None, False, False, False)
@run_with_all_backends
def test_phone_number_already_in_use(self):
    self.assertEqual(PhoneNumber.count_by_domain(self.domain), 0)
    with create_test_case(self.domain, 'participant', 'test1', drop_signals=False) as case1, create_test_case(self.domain, 'participant', 'test2', drop_signals=False) as case2:
        case1 = self.set_case_property(case1, 'contact_phone_number', '99987658765')
        case1 = self.set_case_property(case1, 'contact_phone_number_is_verified', '1')
        case2 = self.set_case_property(case2, 'contact_phone_number', '99987698769')
        case2 = self.set_case_property(case2, 'contact_phone_number_is_verified', '1')
        self.assertIsNotNone(self.get_case_phone_number(case1))
        self.assertIsNotNone(self.get_case_phone_number(case2))
        self.assertEqual(PhoneNumber.count_by_domain(self.domain), 2)
        case2 = self.set_case_property(case2, 'contact_phone_number', '99987658765')
        self.assertIsNotNone(self.get_case_phone_number(case1))
        self.assertIsNotNone(self.get_case_phone_number(case2))
        self.assertEqual(PhoneNumber.count_by_domain(self.domain), 2)
        self.assertPhoneNumberDetails(case1, '99987658765', None, None, True, False, True)
        self.assertPhoneNumberDetails(case2, '99987658765', None, None, False, False, False)