def tearDownClass(cls): MobileBackend.load_by_name(TEST_DOMAIN, TEST_BACKEND).delete() CommCareUser.get_by_username('stella').delete() CommCareUser.get_by_username('super').delete() delete_all_locations() LocationType.objects.all().delete() for product in Product.by_domain(TEST_DOMAIN): product.delete() SQLProduct.objects.all().delete() EWSGhanaConfig.for_domain(TEST_DOMAIN).delete() DocDomainMapping.objects.all().delete() generator.delete_all_subscriptions() Domain.get_by_name(TEST_DOMAIN).delete()
def tearDownClass(cls): MobileBackend.load_by_name(TEST_DOMAIN, TEST_BACKEND).delete() CommCareUser.get_by_username('stella').delete() CommCareUser.get_by_username('bella').delete() CommCareUser.get_by_username('trella').delete() CommCareUser.get_by_username('msd_person').delete() for product in Product.by_domain(TEST_DOMAIN): product.delete() SQLProduct.objects.all().delete() ILSGatewayConfig.for_domain(TEST_DOMAIN).delete() DocDomainMapping.objects.all().delete() Location.by_site_code(TEST_DOMAIN, 'loc1').delete() Location.by_site_code(TEST_DOMAIN, 'loc2').delete() Location.by_site_code(TEST_DOMAIN, 'dis1').delete() Location.by_site_code(TEST_DOMAIN, 'reg1').delete() Location.by_site_code(TEST_DOMAIN, 'moh1').delete() SQLLocation.objects.all().delete() generator.delete_all_subscriptions() Domain.get_by_name(TEST_DOMAIN).delete()
def send_sms_with_backend_name(domain, phone_number, text, backend_name): phone_number = clean_phone_number(phone_number) msg = SMSLog( domain=domain, phone_number=phone_number, direction=OUTGOING, date=datetime.utcnow(), text=text ) def onerror(): logging.exception("Exception while sending SMS to %s with backend name %s from domain %s" % (phone_number, backend_name, domain)) return send_message_via_backend(msg, MobileBackend.load_by_name(domain, backend_name), onerror=onerror)
def send_sms_with_backend_name(domain, phone_number, text, backend_name, metadata=None): phone_number = clean_phone_number(phone_number) backend = MobileBackend.load_by_name(domain, backend_name) msg = SMSLog( domain=domain, phone_number=phone_number, direction=OUTGOING, date=datetime.utcnow(), backend_id=backend._id, text=text ) add_msg_tags(msg, metadata) return queue_outgoing_sms(msg)
def send_sms_with_backend_name(domain, phone_number, text, backend_name, metadata=None): phone_number = clean_phone_number(phone_number) backend = MobileBackend.load_by_name(domain, backend_name) msg = SMSLog( domain=domain, phone_number=phone_number, direction=OUTGOING, date=datetime.utcnow(), backend_id=backend._id, text=text ) add_msg_tags(msg, metadata) def onerror(): logging.exception("Exception while sending SMS to %s with backend name %s from domain %s" % (phone_number, backend_name, domain)) return queue_outgoing_sms(msg, onerror=onerror)
def send_sms_with_backend_name(domain, phone_number, text, backend_name, metadata=None): phone_number = clean_phone_number(phone_number) backend = MobileBackend.load_by_name(domain, backend_name) msg = SMSLog(domain=domain, phone_number=phone_number, direction=OUTGOING, date=datetime.utcnow(), backend_id=backend._id, text=text) add_msg_tags(msg, metadata) return queue_outgoing_sms(msg)
def send_sms_with_backend_name(domain, phone_number, text, backend_name, metadata=None): phone_number = clean_phone_number(phone_number) backend = MobileBackend.load_by_name(domain, backend_name) msg = SMSLog(domain=domain, phone_number=phone_number, direction=OUTGOING, date=datetime.utcnow(), backend_id=backend._id, text=text) add_msg_tags(msg, metadata) def onerror(): logging.exception( "Exception while sending SMS to %s with backend name %s from domain %s" % (phone_number, backend_name, domain)) return queue_outgoing_sms(msg, onerror=onerror)
def set_default_backend(self): domain_object = Domain.get_by_name(self.domain) domain_object.default_sms_backend_id = MobileBackend.load_by_name(None, 'MOBILE_BACKEND_TEST').get_id domain_object.save()
def set_default_backend(self): domain_object = Domain.get_by_name(self.domain) domain_object.default_sms_backend_id = MobileBackend.load_by_name( None, 'MOBILE_BACKEND_TEST').get_id domain_object.save()
def set_default_backend(self): domain_object = Domain.get_by_name(self.domain) domain_object.default_sms_backend_id = MobileBackend.load_by_name(None, 'MOBILE_BACKEND_TEST').get_id domain_object.send_to_duplicated_case_numbers = True domain_object.save()