Skip to content

Conversation

@CoderOMaster
Copy link

@CoderOMaster CoderOMaster commented Dec 23, 2025

Brief summary of the change made

Copied tests cases from OpenPAYGO-Token Repository (Archived), refactored them based on relevant imports, added error handling during hex decoding, copied and refactor device and service simulators and improved token encoding and decoding script to handle changes.
Link-> https://github.com/EnAccess/OpenPAYGO-Token.git

closes: #13

Are there any other side effects of this change that we should be aware of?

I do not think so

Describe how you tested your changes?

I have followed the readme.md to run my changes as well as pytest for original test to make sure it works

Pull Request checklist

Please confirm you have completed any of the necessary steps below.

  • Meaningful Pull Request title and description
  • Changes tested as described above
  • Added appropriate documentation for the change.
  • [N] Created GitHub issues for any relevant followup/future enhancements if appropriate.

Copy link
Member

@dmohns dmohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good already! Left a couple of comments

Comment on lines 149 to 158
if isinstance(secret_key, (bytes, bytearray)):
secret_key_bytes = bytes(secret_key)
if len(secret_key_bytes) != 16:
raise ValueError(
"The secret key provided is not correctly formatted, it should be "
"16 "
"bytes. "
)
return secret_key_bytes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to change code in the metrics part? Your changes are only touching Token tests, right?

Comment on lines 150 to 152
if not past_used_counts:
if past_used_counts is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change required? It seem less "pythonic". Looks like you want to continue processing, when past_used_counts is an empty array, but exit the processing when None. Can you find a more descriptive way of achieving this?

@dmohns
Copy link
Member

dmohns commented Jan 5, 2026

Hey @CoderOMaster

another comment: I have updated the library to use a more modern tooling uv. Could you update your README instructions accordingly? I.e. we no longer have to manually manage VENVs and stuff, as uv takes care of it.

Also, probably need to resolve merge conflicts. Apologies for the additional effort 🙏

Copy link
Member

@dmohns dmohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @CoderOMaster

left some more comments.

## Issues

Issues are created [here](https://github.com/EnAccess/OpenPAYGO-python/issues/new/choose)
Create new issues in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file still shows changes. Please fully revert 😉

Comment on lines +3 to +17
To run the test, first, create and activate a virtual environment. Then install the module and run the test:

```bash
cd tests
python -m venv env
source env/bin/activate
python -m pip install -e ..
python simple_scenario_test.py
```

You can do it for full test procedure as well:

```bash
python full_test_procedure.py
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much simpler in the new repo. Just

uv run python test/simple_scenario_test.py 
uv run python test/full_test_procedure.py

Can you adapt the README ?

Comment on lines +137 to +138
if used_counts is None:
used_counts = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't modify existing code, yet. Unless there is a very specific reason to do so!

Comment on lines +64 to +72
if isinstance(secret_key, (bytes, bytearray)):
secret_key_bytes = bytes(secret_key)
if len(secret_key_bytes) != 16:
raise ValueError(
"The secret key provided is not correctly formatted, it should be "
"16 "
"bytes. "
)
return secret_key_bytes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain again, why this is required?

@dmohns
Copy link
Member

dmohns commented Jan 19, 2026

PS: You need to run Black and ruff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port test cases from archived OpenPAYGO-Token repository

3 participants