33import pytest
44
55from ted_sws import config
6- from ted_sws .notice_publisher .adapters .notice_publisher import NoticePublisherFactory , Publisher
7- from ted_sws .notice_publisher .adapters .sftp_notice_publisher import SFTPNoticePublisher
8-
9-
10- def test_notice_publisher ():
11- with pytest .raises (Exception ):
12- NoticePublisherFactory .get_publisher (publisher = Publisher .SFTP , hostname = None )
13- NoticePublisherFactory .get_publisher (publisher = Publisher .SFTP , hostname = "HOST" , username = "USER" , password = "PASS" ,
14- port = 0 , remote_path = "" )
6+ from ted_sws .notice_publisher .adapters .sftp_notice_publisher import SFTPPublisher
157
168
179def test_sftp_notice_publisher ():
18- user = config .SFTP_USER
19- password = config .SFTP_PASSWORD
20- host = None
21- port = 0
22-
23- sftp_publisher = SFTPNoticePublisher (hostname = host , username = user , password = password , port = port , remote_path = None )
10+ sftp_publisher = SFTPPublisher (port = 0 )
2411
2512 with pytest .raises (Exception ):
2613 sftp_publisher .connect ()
2714
28- sftp_publisher .hostname = config .SFTP_HOST
29- sftp_publisher .port = int (config .SFTP_PORT )
15+ sftp_publisher .port = config .SFTP_PORT
3016 sftp_publisher .connect ()
3117
3218 source_file = tempfile .NamedTemporaryFile ()
@@ -51,3 +37,4 @@ def test_sftp_notice_publisher():
5137 assert not sftp_publisher .connection .exists (remote_path )
5238
5339 sftp_publisher .disconnect ()
40+
0 commit comments