(self)
| 944 | self.assertIsInstance(self.client.sock, ssl.SSLSocket) |
| 945 | |
| 946 | def test_data_connection(self): |
| 947 | # clear text |
| 948 | with self.client.transfercmd('list') as sock: |
| 949 | self.assertNotIsInstance(sock, ssl.SSLSocket) |
| 950 | self.assertEqual(sock.recv(1024), |
| 951 | LIST_DATA.encode(self.client.encoding)) |
| 952 | self.assertEqual(self.client.voidresp(), "226 transfer complete") |
| 953 | |
| 954 | # secured, after PROT P |
| 955 | self.client.prot_p() |
| 956 | with self.client.transfercmd('list') as sock: |
| 957 | self.assertIsInstance(sock, ssl.SSLSocket) |
| 958 | # consume from SSL socket to finalize handshake and avoid |
| 959 | # "SSLError [SSL] shutdown while in init" |
| 960 | self.assertEqual(sock.recv(1024), |
| 961 | LIST_DATA.encode(self.client.encoding)) |
| 962 | self.assertEqual(self.client.voidresp(), "226 transfer complete") |
| 963 | |
| 964 | # PROT C is issued, the connection must be in cleartext again |
| 965 | self.client.prot_c() |
| 966 | with self.client.transfercmd('list') as sock: |
| 967 | self.assertNotIsInstance(sock, ssl.SSLSocket) |
| 968 | self.assertEqual(sock.recv(1024), |
| 969 | LIST_DATA.encode(self.client.encoding)) |
| 970 | self.assertEqual(self.client.voidresp(), "226 transfer complete") |
| 971 | |
| 972 | def test_login(self): |
| 973 | # login() is supposed to implicitly secure the control connection |
nothing calls this directly
no test coverage detected