refactor customer interface to attributes
This commit is contained in:
@@ -10,6 +10,6 @@ from src.models import KeypadSize
|
||||
def test_attr_set_idx(keypad_size):
|
||||
user_interface = UserInterface.new(keypad_size)
|
||||
for attr_idx in range(70):
|
||||
user_interface_idx = user_interface.attr_indices[attr_idx]
|
||||
user_interface_idx = user_interface.interface[attr_idx]
|
||||
|
||||
assert (attr_idx % keypad_size.attrs_per_key == user_interface_idx % keypad_size.attrs_per_key)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from src.models import KeypadSize
|
||||
from src.user_cipher_keys import UserCipherKeys, CustomerInterface
|
||||
from src.user_cipher_keys import UserCipherKeys, CustomerAttributes
|
||||
from src.utils import generate_random_nonrepeating_list
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ def test_encode_decode_base64(passcode_len):
|
||||
(KeypadSize(numb_of_keys=8, attrs_per_key=7), 12),
|
||||
])
|
||||
def test_decode_mask(keypad_size, max_nkode_len):
|
||||
customer = CustomerInterface.new(keypad_size)
|
||||
customer = CustomerAttributes.new(keypad_size)
|
||||
passcode_entry = generate_random_nonrepeating_list(
|
||||
keypad_size.numb_of_attrs,
|
||||
max_val=keypad_size.numb_of_attrs)[:4]
|
||||
|
||||
@@ -25,9 +25,9 @@ def test_shuffle_attrs(user_interface):
|
||||
- every attribute is adjacent to every other attribute with uniform distribution
|
||||
- the order in which the attributes move from key to key is random (i.e. the distance traveled is uniform)
|
||||
"""
|
||||
pre_shuffle_interface = user_interface.attr_indices
|
||||
pre_shuffle_interface = user_interface.interface
|
||||
user_interface.shuffle_interface()
|
||||
post_shuffle_interface = user_interface.attr_indices
|
||||
post_shuffle_interface = user_interface.interface
|
||||
for i in range(1000):
|
||||
assert (not all(
|
||||
post_shuffle_interface[idx] == pre_shuffle_interface[idx] for idx in range(len(post_shuffle_interface))
|
||||
|
||||
Reference in New Issue
Block a user