-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: Add session custom form validations #7112
Conversation
@@ -4,6 +4,7 @@ | |||
from app.models.speaker import Speaker | |||
from tests.factories.speaker import SpeakerSubFactory | |||
from tests.factories.speakers_call import SpeakersCallSubFactory | |||
from tests.factories.track import TrackSubFactory |
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.
'tests.factories.track.TrackSubFactory' imported but unused
|
||
data = json.dumps( | ||
{ | ||
'data': { |
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.
Black would make changes.
5f4b3c8
to
0ec3f7b
Compare
app/api/helpers/custom_forms.py
Outdated
@@ -62,11 +64,11 @@ def validate_custom_form_constraints(form, obj): | |||
return data if data else None | |||
|
|||
|
|||
def validate_custom_form_constraints_request(form, schema, obj, data): | |||
def validate_custom_form_constraints_request(form, schema, obj, data, field_overrides=[]): |
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.
Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
Issues
======
- Added 1
Complexity increasing per file
==============================
- app/api/helpers/custom_forms.py 1
- tests/all/integration/api/session/test_session_api.py 8
Complexity decreasing per file
==============================
+ app/api/schema/sessions.py -2
Clones added
============
- tests/all/integration/api/session/test_session_api.py 31
See the complete overview on Codacy |
assert session.language is None | ||
|
||
|
||
def test_custom_form_create_complex_fields_missing_required(db, client, user, jwt): |
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.
Codecov Report
@@ Coverage Diff @@
## development #7112 +/- ##
===============================================
+ Coverage 62.51% 62.80% +0.28%
===============================================
Files 262 262
Lines 13004 13005 +1
===============================================
+ Hits 8130 8168 +38
+ Misses 4874 4837 -37
Continue to review full report at Codecov.
|
Fixes #7116
Fixes #7074