mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Reformat code with black and isort.
This commit is contained in:
@@ -2,27 +2,31 @@
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._scramble import (
|
||||
scramble,
|
||||
unscramble,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('plaintext, key, scrambled', [
|
||||
('', b'0', '=S='),
|
||||
('hello', b'\x00', '=S=aGVsbG8='),
|
||||
('hello', b'\x01', '=S=aWRtbW4='),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"plaintext, key, scrambled",
|
||||
[
|
||||
("", b"0", "=S="),
|
||||
("hello", b"\x00", "=S=aGVsbG8="),
|
||||
("hello", b"\x01", "=S=aWRtbW4="),
|
||||
],
|
||||
)
|
||||
def test_scramble_unscramble(plaintext, key, scrambled):
|
||||
scrambled_ = scramble(plaintext, key)
|
||||
print(f'{scrambled_!r} == {scrambled!r}')
|
||||
print(f"{scrambled_!r} == {scrambled!r}")
|
||||
assert scrambled_ == scrambled
|
||||
|
||||
plaintext_ = unscramble(scrambled, key)
|
||||
print(f'{plaintext_!r} == {plaintext!r}')
|
||||
print(f"{plaintext_!r} == {plaintext!r}")
|
||||
assert plaintext_ == plaintext
|
||||
|
||||
Reference in New Issue
Block a user