def test_pysswords_returns_false_with_logging_when_not_installed(mocker): to_patch = 'passpie.importers.pysswords_importer.found_pysswords' mocker.patch(to_patch, return_value=False) importer = PysswordsImporter() importer.log = mocker.Mock() result = importer.match('filepath') assert result is False assert importer.log.called importer.log.assert_called_once_with('Pysswords is not installed')
def test_pysswords_match_returns_true_when_expected_path(mocker): to_patch = 'passpie.importers.pysswords_importer.found_pysswords' mocker.patch(to_patch, return_value=True) mock_os = mocker.patch('passpie.importers.pysswords_importer.os') mock_os.path.is_dir.return_value = True mock_os.listdir.return_value = ['.keys'] importer = PysswordsImporter() result = importer.match('filepath') assert result is True
def test_pysswords_returns_false_with_logging_when_not_installed(mocker): to_patch = 'passpie.importers.pysswords_importer.found_pysswords' mocker.patch(to_patch, return_value=False) importer = PysswordsImporter() importer.log = Mock() result = importer.match('filepath') assert result is False assert importer.log.called importer.log.assert_called_once_with('Pysswords is not installed')
def test_pysswords_returns_false_with_logging_when_path_not_dir(mocker): to_patch = 'passpie.importers.pysswords_importer.found_pysswords' mocker.patch(to_patch, return_value=True) mock_os = mocker.patch('passpie.importers.pysswords_importer.os') mock_os.path.is_dir.return_value = False importer = PysswordsImporter() importer.log = mocker.Mock() result = importer.match('filepath') assert result is False assert importer.log.called importer.log.assert_called_once_with('.keys not found in path')
def test_pysswords_returns_false_with_logging_when_path_not_dir(mocker): to_patch = 'passpie.importers.pysswords_importer.found_pysswords' mocker.patch(to_patch, return_value=True) mock_os = mocker.patch('passpie.importers.pysswords_importer.os') mock_os.path.is_dir.return_value = False importer = PysswordsImporter() importer.log = Mock() result = importer.match('filepath') assert result is False assert importer.log.called importer.log.assert_called_once_with('.keys not found in path')
def test_pysswords_returns_false_with_logging_when_keys_not_in_path(mocker): to_patch = "passpie.importers.pysswords_importer.found_pysswords" mocker.patch(to_patch, return_value=True) mock_os = mocker.patch("passpie.importers.pysswords_importer.os") mock_os.path.is_dir.return_value = True mock_os.listdir.return_value = [] importer = PysswordsImporter() importer.log = mocker.Mock() result = importer.match("filepath") assert result is False assert importer.log.called importer.log.assert_called_once_with(".keys not found in path")