示例#1
0
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')
示例#2
0
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')
示例#3
0
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')
示例#4
0
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')
示例#5
0
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")