Ejemplo n.º 1
0
 def test_parse(self):
     data_str = base64.b64encode(six.b("File Data")).decode('ascii')
     data = GetCommand.parse_response(ET.fromstring(GET_FILE_BLOCK.format(data=data_str)))
     self.assertEqual(six.b("File Data"), data)
Ejemplo n.º 2
0
    def test_parse_error(self):
        errinfo = GetCommand.parse_response(
            ET.fromstring(ERROR_BLOCK.format(command='get_file', errno=1, errtext="error text")))

        self.assertEqual(errinfo.errno, 1)
        self.assertEqual(errinfo.message, "error text")
Ejemplo n.º 3
0
 def test_parse_empty(self):
     data = GetCommand.parse_response(ET.fromstring(GET_FILE_BLOCK.format(data='')))
     self.assertEqual(six.b(""), data)