-
Notifications
You must be signed in to change notification settings - Fork 90
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
[Backend]Test asset groups creation/update (#1494) #2150
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release/1.11.0 #2150 +/- ##
====================================================
+ Coverage 35.98% 36.07% +0.08%
- Complexity 1487 1491 +4
====================================================
Files 546 546
Lines 16626 16630 +4
Branches 1061 1061
====================================================
+ Hits 5983 5999 +16
+ Misses 10340 10328 -12
Partials 303 303 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, thanks !
Apart from a few nitpicks, perhaps also consider adding more tests cases, e.g.:
- for when the asset group does not exist (for update)
- for other types of properties, eg description, tags, filter (create, update).
openbas-api/src/test/java/io/openbas/rest/asset_group/AssetGroupTest.java
Outdated
Show resolved
Hide resolved
openbas-api/src/test/java/io/openbas/rest/asset_group/AssetGroupTest.java
Outdated
Show resolved
Hide resolved
openbas-api/src/test/java/io/openbas/rest/asset_group/AssetGroupTest.java
Outdated
Show resolved
Hide resolved
openbas-api/src/test/java/io/openbas/rest/asset_group/AssetGroupTest.java
Outdated
Show resolved
Hide resolved
openbas-api/src/test/java/io/openbas/rest/asset_group/AssetGroupTest.java
Outdated
Show resolved
Hide resolved
openbas-api/src/test/java/io/openbas/rest/asset_group/AssetGroupTest.java
Outdated
Show resolved
Hide resolved
Johanah being on leave, I take over on her PRs. I took your comments into account and added the Transactional annotation. I also took the opportunity to change the name of the methods to follow this pattern: given this should have that. |
dd284ac
to
0a5b2ac
Compare
Great pattern IMO for self explanatory test scopes. "Given this then that" or "when/with this it does that" are two widely used speech-like patterns that are also useful for the developer to limit the scope of their own tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too :) Just a small nitpick but I think we should return a 404 if deleting a non existent element. It seems more logical to me as it can hide an issue in the frontend :
Imagine you have a bad code on your frontend or a client of the API, you have the id incorrectly set. You'll get back a 200 but the element won't be correctly deleted. Debugging this might prove annoying.
#1494