Beispiel #1
0
 def test__get_scciresult__bad_xml(self):
     sccireturndata = """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><CMDSEQ><CMD></CMDSEQ>"""
     sccidata, scciresult, sccicontext = irmc_scci_utils.get_scciresult(
         sccireturndata, 0)
     self.assertEqual(95, scciresult)
     self.assertIn("SCCI result was not correct XML", str(sccidata))
     self.assertIn("Traceback", str(sccicontext))
Beispiel #2
0
 def test__get_scciresult__all_is_well_overall(self):
     status = 0
     sccireturndata = """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>""" \
                      """<Status>""" \
                      """<Value>{0}</Value>""" \
                      """<Severity>Information</Severity>""" \
                      """<Message>No Error</Message>""" \
                      """</Status>""".format(status)
     sccidata, scciresult, sccicontext = irmc_scci_utils.get_scciresult(
         sccireturndata, 0)
     self.assertEqual(status, scciresult)
     self.assertEqual("", sccicontext)
     self.assertEqual("", sccidata)
Beispiel #3
0
 def test__get_scciresult__all_is_well_data_integer_1457(self):
     dataint = "999"  # param data is always a string
     status = 0
     sccireturndata = irmc_scci_utils.scci_body_start
     sccireturndata += """<CMD Context="SCCI" OC="ConfigSpace" OE="1457" OI="0" Type="GET">""" \
                       """<DATA Type="xsd::integer">{0}</DATA><STATUS>{1}</STATUS>""" \
                       """</CMD>""".format(dataint, status)
     sccireturndata += irmc_scci_utils.scci_body_end
     sccidata, scciresult, sccicontext = irmc_scci_utils.get_scciresult(
         sccireturndata, 0x1457)
     self.assertEqual(status, scciresult)
     self.assertEqual("", sccicontext)
     self.assertEqual(dataint, sccidata)
Beispiel #4
0
 def test__get_scciresult__all_is_well_data_string_1455(self):
     datastr = "TestData"
     status = 0
     sccireturndata = irmc_scci_utils.scci_body_start
     sccireturndata += """<CMD Context="SCCI" OC="ConfigSpace" OE="1455" OI="0" Type="GET">""" \
                       """<DATA Type="xsd::string">{0}</DATA><STATUS>{1}</STATUS>""" \
                       """</CMD>""".format(datastr, status)
     sccireturndata += irmc_scci_utils.scci_body_end
     sccidata, scciresult, sccicontext = irmc_scci_utils.get_scciresult(
         sccireturndata, 0x1455)
     self.assertEqual(status, scciresult)
     self.assertEqual("", sccicontext)
     self.assertEqual(datastr, sccidata)
Beispiel #5
0
 def test__get_scciresult__bad_overall_status(self):
     datastr = ""
     opcode = 0x1455
     status = 31
     sccireturndata = """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>""" \
                      """<Status>""" \
                      """<Value>{0}</Value>""" \
                      """<Severity>Error</Severity>""" \
                      """<Message>Error {0}</Message>""" \
                      """</Status>""".format(status)
     sccidata, scciresult, sccicontext = irmc_scci_utils.get_scciresult(
         sccireturndata, opcode)
     self.assertEqual(status, scciresult)
     self.assertEqual("Error {0}".format(status), sccicontext)
     self.assertEqual(datastr, sccidata)
Beispiel #6
0
 def test__get_scciresult__bad_scci_status(self):
     datastr = "TestData"
     opcode = 0x1455
     status = 1
     sccireturndata = """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>""" \
                      """<Status>""" \
                      """<Value>{0}</Value>""" \
                      """<Severity>Error</Severity>""" \
                      """<Message>Error {0} (Import of settings in WinSCU XML format failed) occurred</Message>""" \
                      """<Error Context="SCCI" OC="ConfigSpace" OE="{1}" OI="3">{2}</Error>""" \
                      """</Status>""".format(status, format(opcode, 'X'), datastr)
     sccidata, scciresult, sccicontext = irmc_scci_utils.get_scciresult(
         sccireturndata, opcode)
     self.assertEqual(status, scciresult)
     self.assertEqual(
         "OpCodeExt 0x{0}: {1} ({2})".format(format(opcode, 'X'), datastr,
                                             status), sccicontext)
     self.assertEqual(datastr, sccidata)