@@ -12,7 +12,7 @@ def __init__(self, *args, **kwargs):
1212
1313 def test_add_file_success (self ):
1414 request = self .conn .touserqueue .get (timeout = 0.2 )
15- self .assertEqual (request , b"\x38 \x01 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x52 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x01 \x11 " )
15+ self .assertEqual (request , b"\x38 \x01 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x52 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x01 \x11 " )
1616 self .conn .fromuserqueue .put (b"\x78 \x01 \x02 \xab \xcd \x52 " ) # Positive response
1717
1818 def _test_add_file_success (self ):
@@ -134,7 +134,7 @@ def _test_add_file_extra_bytes_response_zero_padding_not_ok(self):
134134
135135 def test_delete_file_success (self ):
136136 request = self .conn .touserqueue .get (timeout = 0.2 )
137- self .assertEqual (request , b"\x38 \x02 \x0b " + "my_file.txt" .encode ('ascii' ))
137+ self .assertEqual (request , b"\x38 \x02 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ))
138138 self .conn .fromuserqueue .put (b"\x78 \x02 " ) # Positive response
139139
140140 def _test_delete_file_success (self ):
@@ -221,7 +221,7 @@ def _test_delete_file_extra_bytes_response_zero_padding_not_ok(self):
221221
222222 def test_replace_file_success (self ):
223223 request = self .conn .touserqueue .get (timeout = 0.2 )
224- self .assertEqual (request , b"\x38 \x03 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x52 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x01 \x11 " )
224+ self .assertEqual (request , b"\x38 \x03 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x52 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x01 \x11 " )
225225 self .conn .fromuserqueue .put (b"\x78 \x03 \x02 \xab \xcd \x52 " ) # Positive response
226226
227227 def _test_replace_file_success (self ):
@@ -360,7 +360,7 @@ def _test_replace_file_extra_bytes_response_zero_padding_not_ok(self):
360360
361361 def test_read_file_success (self ):
362362 request = self .conn .touserqueue .get (timeout = 0.2 )
363- self .assertEqual (request , b"\x38 \x04 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x52 " )
363+ self .assertEqual (request , b"\x38 \x04 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x52 " )
364364 self .conn .fromuserqueue .put (b"\x78 \x04 \x02 \xab \xcd \x52 \x00 \x02 \x98 \x76 \x12 \x34 " ) # Positive response
365365
366366 def _test_read_file_success (self ):
@@ -504,7 +504,7 @@ def _test_read_file_extra_bytes_response_zero_padding_not_ok(self):
504504
505505 def test_read_dir_success (self ):
506506 request = self .conn .touserqueue .get (timeout = 0.2 )
507- self .assertEqual (request , b"\x38 \x05 \x0c " + "/path/to/dir" .encode ('ascii' ))
507+ self .assertEqual (request , b"\x38 \x05 \x00 \ x0c " + "/path/to/dir" .encode ('ascii' ))
508508 self .conn .fromuserqueue .put (b"\x78 \x05 \x02 \xab \xcd \x00 \x00 \x02 \x12 \x34 " ) # Positive response
509509
510510 def _test_read_dir_success (self ):
@@ -660,7 +660,7 @@ def _test_wrong_service_reply_no_exception(self):
660660
661661 def test_default_dfi (self ):
662662 request = self .conn .touserqueue .get (timeout = 0.2 )
663- self .assertEqual (request , b"\x38 \x01 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x01 \x11 " )
663+ self .assertEqual (request , b"\x38 \x01 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x01 \x11 " )
664664 self .conn .fromuserqueue .put (b"\x78 \x01 \x02 \xab \xcd \x00 " ) # Positive response
665665
666666 def _test_default_dfi (self ):
@@ -670,23 +670,23 @@ def _test_default_dfi(self):
670670
671671 def test_default_filesize_width (self ):
672672 request = self .conn .touserqueue .get (timeout = 0.2 )
673- self .assertEqual (request , b"\x38 \x01 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x02 \x02 \x22 \x01 \x11 " )
673+ self .assertEqual (request , b"\x38 \x01 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x02 \x02 \x22 \x01 \x11 " )
674674 self .conn .fromuserqueue .put (b"\x78 \x01 \x02 \xab \xcd \x00 " ) # Positive response
675675
676676 def _test_default_filesize_width (self ):
677677 self .udsclient .request_file_transfer (moop = 1 , path = "my_file.txt" , filesize = Filesize (uncompressed = 0x222 , compressed = 0x111 ))
678678
679679 def test_filesize_no_compressed_size (self ):
680680 request = self .conn .touserqueue .get (timeout = 0.2 )
681- self .assertEqual (request , b"\x38 \x01 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x02 \x22 " )
681+ self .assertEqual (request , b"\x38 \x01 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x04 \x00 \x00 \x02 \x22 \x00 \x00 \x02 \x22 " )
682682 self .conn .fromuserqueue .put (b"\x78 \x01 \x02 \xab \xcd \x00 " ) # Positive response
683683
684684 def _test_filesize_no_compressed_size (self ):
685685 self .udsclient .request_file_transfer (moop = 1 , path = "my_file.txt" , filesize = Filesize (uncompressed = 0x222 , width = 4 ))
686686
687687 def test_filesize_numerical (self ):
688688 request = self .conn .touserqueue .get (timeout = 0.2 )
689- self .assertEqual (request , b"\x38 \x01 \x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x02 \x01 \x00 \x01 \x00 " )
689+ self .assertEqual (request , b"\x38 \x01 \x00 \ x0b " + "my_file.txt" .encode ('ascii' ) + b"\x00 \x02 \x01 \x00 \x01 \x00 " )
690690 self .conn .fromuserqueue .put (b"\x78 \x01 \x02 \xab \xcd \x00 " ) # Positive response
691691
692692 def _test_filesize_numerical (self ):
@@ -704,7 +704,7 @@ def _test_bad_param(self):
704704 good_filesize = Filesize (uncompressed = 0x222 , compressed = 0x111 , width = 4 )
705705 good_dfi = DataFormatIdentifier (compression = 5 , encryption = 2 )
706706 with self .assertRaises (ValueError ):
707- self .udsclient .request_file_transfer (moop = 1 , path = "a" * 256 , dfi = good_dfi , filesize = good_filesize )
707+ self .udsclient .request_file_transfer (moop = 1 , path = "a" * ( 2 ** 16 ) , dfi = good_dfi , filesize = good_filesize )
708708
709709 with self .assertRaises (ValueError ):
710710 self .udsclient .request_file_transfer (moop = 1 , path = "" , dfi = good_dfi , filesize = good_filesize )
0 commit comments