| 243 | | self.assertEqual(data, expected_data) |
|---|
| 244 | | |
|---|
| 245 | | # def ascii_write(self): |
|---|
| 246 | | # """Write an ASCII text to the host and check the written file.""" |
|---|
| 247 | | # host = self.host |
|---|
| 248 | | # local_data = ' \nline 2\nline 3' |
|---|
| 249 | | # # write data in ASCII mode |
|---|
| 250 | | # self.write_test_data(local_data, 'w') |
|---|
| 251 | | # # read data back in binary mode |
|---|
| 252 | | # input_ = host.file(self.remote_name, 'rb') |
|---|
| 253 | | # remote_data = input_.read() |
|---|
| 254 | | # input_.close() |
|---|
| 255 | | # # expect the same data as above if we have a |
|---|
| 256 | | # # Unix FTP server |
|---|
| 257 | | # self.assertEqual(local_data, remote_data) |
|---|
| 258 | | # |
|---|
| | 243 | self.assertEqual(child_data, expected_data) |
|---|
| | 244 | |
|---|
| | 245 | def test_ascii_write(self): |
|---|
| | 246 | """Write an ASCII text to the host and check the written file.""" |
|---|
| | 247 | host = ftp_host_factory() |
|---|
| | 248 | data = ' \nline 2\nline 3' |
|---|
| | 249 | expected_data = ' \r\nline 2\r\nline 3' |
|---|
| | 250 | file = host.file('dummy', 'w') |
|---|
| | 251 | file.write(data) |
|---|
| | 252 | child_data = host.file_content_for_child(0) |
|---|
| | 253 | file.close() |
|---|
| | 254 | self.assertEqual(child_data, expected_data) |
|---|
| | 255 | |
|---|