Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jul 8, 2024
1 parent 730e062 commit 6621db8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyftpdlib/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ def reset_server_opts():
klass.use_sendfile = hasattr(os, "sendfile")
klass.ac_in_buffer_size = 4096
klass.ac_out_buffer_size = 4096
klass.encoding = "utf8"
if klass.__name__ == 'TLS_FTPHandler':
klass.tls_control_required = False
klass.tls_data_required = False
Expand Down
11 changes: 11 additions & 0 deletions pyftpdlib/test/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,7 @@ def tearDown(self):
self.server.handler.passive_ports = None
self.server.handler.use_gmt_times = True
self.server.handler.tcp_no_delay = hasattr(socket, 'TCP_NODELAY')
self.server.handler.encoding = "utf8"
self.server.stop()
super().tearDown()

Expand Down Expand Up @@ -1907,6 +1908,16 @@ def test_use_gmt_times(self):
assert gmt2 == loc2
assert gmt3 == loc3

def test_encoding(self):
# Make sure that if encoding != UTF-8, FEAT command does not
# list UTF-8.
self.server = self.server_class()
self.server.handler.encoding = "latin-1"
self.server.start()
self.connect()
resp = self.client.sendcmd('feat')
assert 'UTF8' not in resp


@pytest.mark.xdist_group(name="serial")
class TestCallbacks(PyftpdlibTestCase):
Expand Down

0 comments on commit 6621db8

Please sign in to comment.