refactory
This commit is contained in:
@@ -36,8 +36,8 @@ mock_utils_config.set_config.config.return_value = mock_config_instance
|
||||
# sys.modules['pyftpdlib.servers'] = MagicMock()
|
||||
|
||||
# Import the module AFTER mocking dependencies
|
||||
import FtpCsvReceiver
|
||||
from FtpCsvReceiver import (
|
||||
import ftp_csv_receiver
|
||||
from ftp_csv_receiver import (
|
||||
extract_value,
|
||||
DummySha256Authorizer,
|
||||
ASEHandler,
|
||||
@@ -193,13 +193,13 @@ class TestDummySha256Authorizer(unittest.TestCase):
|
||||
def test_validate_authentication_wrong_password(self):
|
||||
self.mock_cursor.fetchall.return_value = []
|
||||
authorizer = DummySha256Authorizer(self.mock_cfg)
|
||||
with self.assertRaises(FtpCsvReceiver.AuthenticationFailed):
|
||||
with self.assertRaises(ftp_csv_receiver.AuthenticationFailed):
|
||||
authorizer.validate_authentication('admin', 'wrongpass', None)
|
||||
|
||||
def test_validate_authentication_unknown_user(self):
|
||||
self.mock_cursor.fetchall.return_value = []
|
||||
authorizer = DummySha256Authorizer(self.mock_cfg)
|
||||
with self.assertRaises(FtpCsvReceiver.AuthenticationFailed):
|
||||
with self.assertRaises(ftp_csv_receiver.AuthenticationFailed):
|
||||
authorizer.validate_authentication('unknown', 'somepass', None)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user