Skip to content

Commit

Permalink
test in progress..
Browse files Browse the repository at this point in the history
  • Loading branch information
hexfati committed Nov 19, 2024
1 parent 02d747d commit fc48954
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/test_ftps_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from wadas.domain.ftps_server import FTPsServer

FTP_PORT = 8888


@pytest.fixture
def ftps_server():
Expand All @@ -17,7 +19,7 @@ def ftps_server():
util.cert_gen(key_path, cert_path)
return FTPsServer(
"127.0.0.1",
21,
FTP_PORT,
[65522, 65523],
50,
5,
Expand All @@ -31,7 +33,7 @@ def test_ftp_server_init(ftps_server):
assert ftps_server is not None
assert isinstance(ftps_server, FTPsServer)
assert ftps_server.ip == "127.0.0.1"
assert ftps_server.port == 21
assert ftps_server.port == FTP_PORT
assert ftps_server.passive_ports == [65522, 65523]


Expand All @@ -55,33 +57,33 @@ def ftp_client_connect(host, port, username, password):
return resp


@pytest.mark.skip(reason="Permission denied error on GitHub Actions")
# @pytest.mark.skip(reason="Permission denied error on GitHub Actions")
def test_server_working(ftps_server):
username = "camera1"
password = "pass1"
add_user(ftps_server, username, password)
thread = ftps_server.run()
assert thread is not None
time.sleep(2)
resp = ftp_client_connect("127.0.0.1", 21, username, password)
resp = ftp_client_connect("127.0.0.1", FTP_PORT, username, password)
assert resp == "230 Login successful."
ftps_server.server.close_all()


@pytest.mark.skip(reason="Permission denied error on GitHub Actions")
# @pytest.mark.skip(reason="Permission denied error on GitHub Actions")
def test_hot_add_user(ftps_server):
username = "camera1"
password = "pass1"
thread = ftps_server.run()
assert thread is not None
time.sleep(2)
add_user(ftps_server, username, password)
resp = ftp_client_connect("127.0.0.1", 21, username, password)
resp = ftp_client_connect("127.0.0.1", FTP_PORT, username, password)
assert resp == "230 Login successful."
ftps_server.server.close_all()


@pytest.mark.skip(reason="Permission denied error on GitHub Actions")
# @pytest.mark.skip(reason="Permission denied error on GitHub Actions")
def test_server_restart(ftps_server):
username = "camera1"
password = "pass1"
Expand All @@ -94,6 +96,6 @@ def test_server_restart(ftps_server):
thread = ftps_server.run()
assert thread is not None
time.sleep(2)
resp = ftp_client_connect("127.0.0.1", 21, username, password)
resp = ftp_client_connect("127.0.0.1", FTP_PORT, username, password)
assert resp == "230 Login successful."
ftps_server.server.close_all()

0 comments on commit fc48954

Please sign in to comment.