Exemple #1
0
 def obj_create(self, bundle, **kwargs):
     bundle = self.full_hydrate(bundle)
     self.reinstall_result = SelfRegistrationInvitation.send_install_link(
         bundle.request.domain,
         bundle.obj.users,
         bundle.obj.app_id,
         custom_message=bundle.obj.reinstall_message)
     return bundle
Exemple #2
0
 def obj_create(self, bundle, **kwargs):
     bundle = self.full_hydrate(bundle)
     self.reinstall_result = SelfRegistrationInvitation.send_install_link(
         bundle.request.domain,
         bundle.obj.users,
         bundle.obj.app_id,
         custom_message=bundle.obj.reinstall_message
     )
     return bundle
Exemple #3
0
    def test_resend_install_link(self):
        self.domain_obj.sms_mobile_worker_registration_enabled = True
        self.domain_obj.enable_registration_welcome_sms_for_mobile_worker = True
        self.domain_obj.save()

        with patch.object(SelfRegistrationInvitation, 'get_app_info_url', return_value=DUMMY_APP_INFO_URL):
            success_numbers, invalid_format_numbers, error_numbers = SelfRegistrationInvitation.send_install_link(
                self.domain,
                [SelfRegistrationUserInfo('999123')],
                self.app_id
            )
            self.assertEqual(success_numbers, ['999123'])
            self.assertEqual(invalid_format_numbers, [])
            self.assertEqual(error_numbers, [])

        self.assertLastOutgoingSMS('+999123', [
            _MESSAGES[MSG_REGISTRATION_INSTALL_COMMCARE].format(GOOGLE_PLAY_STORE_COMMCARE_URL),
            '[commcare app - do not delete] {}'.format(DUMMY_APP_INFO_URL),
        ])
Exemple #4
0
    def test_resend_install_link(self):
        self.domain_obj.sms_mobile_worker_registration_enabled = True
        self.domain_obj.enable_registration_welcome_sms_for_mobile_worker = True
        self.domain_obj.save()

        with patch.object(SelfRegistrationInvitation, 'get_app_info_url', return_value=DUMMY_APP_INFO_URL):
            success_numbers, invalid_format_numbers, error_numbers = SelfRegistrationInvitation.send_install_link(
                self.domain,
                [SelfRegistrationUserInfo('999123')],
                self.app_id
            )
            self.assertEqual(success_numbers, ['999123'])
            self.assertEqual(invalid_format_numbers, [])
            self.assertEqual(error_numbers, [])

        self.assertLastOutgoingSMS('+999123', [
            _MESSAGES[MSG_REGISTRATION_INSTALL_COMMCARE].format(GOOGLE_PLAY_STORE_COMMCARE_URL),
            '[commcare app - do not delete] {}'.format(DUMMY_APP_INFO_URL_B64),
        ])
    def test_resend_install_link_with_custom_message(self):
        self.domain_obj.sms_mobile_worker_registration_enabled = True
        self.domain_obj.enable_registration_welcome_sms_for_mobile_worker = True
        self.domain_obj.save()

        with patch.object(SelfRegistrationInvitation, 'get_app_info_url', return_value=DUMMY_APP_INFO_URL):
            success_numbers, invalid_format_numbers, error_numbers = SelfRegistrationInvitation.send_install_link(
                self.domain,
                [SelfRegistrationUserInfo('999123')],
                self.app_id,
                custom_message='Click here to reinstall CommCare: {}'
            )
            self.assertEqual(success_numbers, ['999123'])
            self.assertEqual(invalid_format_numbers, [])
            self.assertEqual(error_numbers, [])

        self.assertLastOutgoingSMS('+999123', [
            'Click here to reinstall CommCare: {}'.format(GOOGLE_PLAY_STORE_COMMCARE_URL),
            '[commcare app - do not delete] {}'.format(DUMMY_APP_INFO_URL_B64),
        ])