Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#334 Add unit tests for critical code sections [2.0] #339

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

jamshale
Copy link
Contributor

@jamshale jamshale commented Sep 19, 2023

I'm sure more testing and better testing can be done but I think this is good enough for this task.
Only testing on python 3.11 now. The project is not compatible with 3.10.

I think the best testing is done in test_issue_token_service.py . It takes expected presentation payloads and assure they generate claims for valid inputs. I think this could be expanded further but it will likely come in handy as examples of how to send different payloads through the tests and will hopefully find any errors with expected functionality if a developer makes changes in the get_claims function.

Added some mock payloads which can be altered to do accurate testing and for context.

There is other testing in the acapy directory which is only somewhat useful. Still think it's nice to have for extra documentation and as a foundation for future features and proper testing.

Added a few TODO comments.

Here is the current coverage:

image

@jamshale jamshale force-pushed the feature/334-unit-test-critical-code-sections branch 2 times, most recently from b4ba994 to cfdb19e Compare September 20, 2023 21:02
@jamshale jamshale changed the title Initial commit Add unit tests for critical code sections [2.0] Sep 20, 2023
@jamshale jamshale force-pushed the feature/334-unit-test-critical-code-sections branch 2 times, most recently from cb00b9d to 77ed95e Compare September 22, 2023 17:30
Signed-off-by: jamshale <[email protected]>
@jamshale jamshale force-pushed the feature/334-unit-test-critical-code-sections branch from 77ed95e to 36efe56 Compare September 22, 2023 17:37
@jamshale jamshale marked this pull request as ready for review September 22, 2023 17:43
@jamshale jamshale requested review from esune and Gavinok September 22, 2023 17:43
@jamshale jamshale changed the title Add unit tests for critical code sections [2.0] #334 Add unit tests for critical code sections [2.0] Sep 22, 2023
Copy link
Member

@esune esune left a comment

Choose a reason for hiding this comment

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

Excellent work! Added a couple of notes that can likely be extended to the remaining, similar scenarios.

Regarding the assertion to check for JSON objects: we are definitely expecting to receive valid JSON,if we use json.loads() to deserialize the payload it might be unnecessary since an exception would/should be thrown there if the object is not valid JSON?

@esune esune merged commit 35316a9 into 2.0-development Sep 25, 2023
2 checks passed
@esune esune deleted the feature/334-unit-test-critical-code-sections branch September 25, 2023 17:10
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.

2 participants