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

feat: Add session custom form validations #7112

Merged
merged 5 commits into from
Jul 7, 2020

Conversation

iamareebjamal
Copy link
Member

@iamareebjamal iamareebjamal commented Jul 4, 2020

Fixes #7116
Fixes #7074

@@ -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

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': {

Choose a reason for hiding this comment

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

Black would make changes.

@iamareebjamal iamareebjamal force-pushed the session-custom-form branch from 5f4b3c8 to 0ec3f7b Compare July 7, 2020 00:01
@auto-label auto-label bot added the feature label Jul 7, 2020
@@ -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=[]):

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.

@niranjan94
Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

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):
Copy link
Member

Choose a reason for hiding this comment

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

@codecov
Copy link

codecov bot commented Jul 7, 2020

Codecov Report

Merging #7112 into development will increase coverage by 0.28%.
The diff coverage is 84.61%.

Impacted file tree graph

@@               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     
Impacted Files Coverage Δ
app/api/speakers.py 68.93% <ø> (ø)
app/api/schema/sessions.py 90.90% <50.00%> (+3.25%) ⬆️
app/api/helpers/custom_forms.py 100.00% <100.00%> (ø)
app/api/sessions.py 51.58% <100.00%> (+10.12%) ⬆️
app/models/event.py 77.27% <0.00%> (+0.90%) ⬆️
app/api/helpers/permission_manager.py 56.29% <0.00%> (+5.59%) ⬆️
app/models/session.py 95.08% <0.00%> (+8.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1937c6...c7317fe. Read the comment docs.

@iamareebjamal iamareebjamal merged commit e18c4a6 into development Jul 7, 2020
@iamareebjamal iamareebjamal deleted the session-custom-form branch July 7, 2020 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Session POST request fails if track is submitted with it Add custom form complex field validation
3 participants