Skip to content

Commit 17a66d1

Browse files
committed
resolved changes
1 parent e426ef5 commit 17a66d1

7 files changed

Lines changed: 4 additions & 22 deletions

File tree

openpaygo/metrics_shared.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,28 +146,10 @@ def generate_hash_string(cls, input_string, secret_key):
146146

147147
@classmethod
148148
def load_secret_key_from_hex(cls, secret_key):
149-
if isinstance(secret_key, (bytes, bytearray)):
150-
secret_key_bytes = bytes(secret_key)
151-
if len(secret_key_bytes) != 16:
152-
raise ValueError(
153-
"The secret key provided is not correctly formatted, it should be "
154-
"16 "
155-
"bytes. "
156-
)
157-
return secret_key_bytes
158-
159149
try:
160-
decoded = codecs.decode(secret_key, "hex")
150+
return codecs.decode(secret_key, "hex")
161151
except Exception:
162152
raise ValueError(
163153
"The secret key provided is not correctly formatted, it should be 32 "
164154
"hexadecimal characters. "
165155
)
166-
167-
if len(decoded) != 16:
168-
raise ValueError(
169-
"The secret key provided is not correctly formatted, it should be 32 "
170-
"hexadecimal characters. "
171-
)
172-
173-
return decoded

openpaygo/token_decode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _count_is_valid(cls, count, last_count, value, type, used_counts):
149149

150150
@classmethod
151151
def update_used_counts(cls, past_used_counts, value, new_count, type):
152-
if past_used_counts is None:
152+
if not past_used_counts:
153153
return None
154154
highest_count = max(past_used_counts) if past_used_counts else 0
155155
if new_count > highest_count:

test/full_test_procedure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
test_name,
1111
)
1212

13-
from openpaygo.simulators.device_simulator import DeviceSimulator
13+
from test.simulators.device_simulator import DeviceSimulator
1414

1515
# This tests the device simulator against the full test procedure
1616

test/simple_scenario_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime, timedelta
22

3-
from openpaygo.simulators import DeviceSimulator, SingleDeviceServerSimulator
3+
from test.simulators import DeviceSimulator, SingleDeviceServerSimulator
44
from openpaygo.token_shared import TokenType
55

66

0 commit comments

Comments
 (0)