Пример #1
0
def test_crypt_make_key_input_handles_unicode_encode_error(mocker):
    passphrase = 's3cr3t'

    class ExpectedUnicodeException(UnicodeEncodeError):
        def __init__(self):
            pass

    side_effect = [ExpectedUnicodeException, KEY_INPUT.format(passphrase)]
    mock_key_input = mocker.patch('passpie.crypt.KEY_INPUT',
                                  new=mocker.MagicMock())
    mock_key_input.format.side_effect = side_effect

    key_input = make_key_input(passphrase)

    assert key_input == KEY_INPUT.format(passphrase)
Пример #2
0
def test_crypt_make_key_input_handles_unicode_encode_error(mocker):
    passphrase = 's3cr3t'
    class ExpectedUnicodeException(UnicodeEncodeError):
        def __init__(self):
            pass

    side_effect = [
        ExpectedUnicodeException,
        KEY_INPUT.format(passphrase)
    ]
    mock_key_input = mocker.patch('passpie.crypt.KEY_INPUT', new=mocker.MagicMock())
    mock_key_input.format.side_effect = side_effect

    key_input = make_key_input(passphrase)

    assert key_input == KEY_INPUT.format(passphrase)
Пример #3
0
    def test_make_key_input_format_with_unicode_characters(self):
        unicode_passphrase = 'áçéèúü'

        self.assertIsNotNone(make_key_input(unicode_passphrase))
Пример #4
0
def test_crypt_make_key_input_handles_unicode_encode_error(mocker):
    passphrase = u"L'éphémère"
    key_length = '2064'
    key_input = make_key_input(passphrase, key_length)

    assert key_input is not None
Пример #5
0
def test_crypt_make_key_input_handles_unicode_encode_error_handling(mocker):
    passphrase = 'passphrase'
    key_length = '2064'
    key_input = KEY_INPUT.format(key_length, passphrase)
    assert key_input == make_key_input(passphrase, key_length)
Пример #6
0
    def test_make_key_input_format_with_unicode_characters(self):
        unicode_passphrase = 'áçéèúü'

        self.assertIsNotNone(make_key_input(unicode_passphrase))
Пример #7
0
def test_crypt_make_key_input_handles_unicode_encode_error(mocker):
    passphrase = u"L'éphémère"
    key_length = '2064'
    key_input = make_key_input(passphrase, key_length)

    assert key_input is not None
Пример #8
0
def test_crypt_make_key_input_handles_unicode_encode_error_handling(mocker):
    passphrase = 'passphrase'
    key_length = '2064'
    key_input = KEY_INPUT.format(key_length, passphrase)
    assert key_input == make_key_input(passphrase, key_length)