def test_existente(self): params = dict() params["msisdn"] = "525546868951" params["iccid"] = "0199123111111122231" soap = Soap() js = soap.alta(params) self.assertTrue(js == 501)
def extract_body(xml, method): soap = Soap() namespaces = { 'soapenv': 'http://www.w3.org/2003/05/soap-envelope' } node = xml.findall("./soapenv:Body", namespaces) code = 0 for child in node[0].getchildren(): data = dict() for ele in child.getchildren(): if "arg0" in ele.tag or "in0" in ele.tag: data["msisdn"] = ele.text elif "arg1" in ele.tag or "in1" in ele.tag: data["iccid"] = ele.text elif "arg2" in ele.tag or "in2" in ele.tag: data["cveplan"] = ele.text elif "arg3" in ele.tag or "in3" in ele.tag: data["cvetpoinst"] = ele.text logger.info("New transaction", extra={'props': {"method": child.tag, "app": config["name"], "data": data}}) if method == "POST": if "alta_aprov_telcel" in child.tag: code = soap.alta(data) elif "suspender_aprov_telcel" in child.tag: code = soap.suspension(data) elif "reactivar_aprov_telcel" in child.tag: code = soap.reactivacion(data) elif "cancelar_aprov_telcel" in child.tag: code = soap.cancelacion(data) elif "modificar_aprov_telcel" in child.tag: data["cveplan"] = data["iccid"] code = soap.update_plan(data) elif "com6_aprov_telcel" in child.tag: logger.info("Request COM_6 processing", extra={'props': {"raw": data, "app": config["name"], "label": config["name"]}}) code = soap.com_6(data) return code
def test_asociado(self): params = dict() params["msisdn"] = "525546868952" params["iccid"] = "0199123111111122231" params["cveplan"] = "" params["cvetpoinst"] = "" soap = Soap() js = soap.alta(params) self.assertTrue(js == 900)
def test_noexistoso(self): params = dict() params["msisdn"] = "525546868951" params["iccid"] = "019912311111112223" params["cveplan"] = "" params["cvetpoinst"] = "" soap = Soap() js = soap.alta(params) self.assertTrue(js == 401)
def test_formato(self): params = dict() params["msisdn"] = "asdsadsasdsa" params["iccid"] = "0199123111111122231" params["cveplan"] = "" params["cvetpoinst"] = "" soap = Soap() js = soap.alta(params) self.assertTrue(js == 300)
def test_mssid(self): params = dict() params["msisdn"] = "46868951" params["iccid"] = "0199123111111122233" params["cveplan"] = "" params["cvetpoinst"] = "" soap = Soap() js = soap.alta(params) self.assertTrue(js == 100)