Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Add checks for extra field in model create #766

Merged

Conversation

Monal5031
Copy link
Contributor

Description

Until now only mandatory fields were being saved but we should add checks for other fields too, at least in 1 test. Since these are non-mandatory fields and we'll be shifting to using dicts instead of lists I've used a workaround for now (using length compare) while creating the event. In future we'll need to modify it

Fixes #752

Type of Change:

Delete irrelevant options.

  • Code
  • Quality Assurance

Code/Quality Assurance Only

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update (software upgrade on readme file)
  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

python manage.py test event.tests.test_model -v 2

Checklist:

Delete irrelevant options.

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged

Code/Quality Assurance Only

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downstream modules

@Monal5031 Monal5031 added Type: Enhancement New feature or request. Category: Quality Assurance Changes to code or files that improve testing or fixes bugs. Program: GSOC Related to work completed during the Google Summer of Code Program. category: testing labels Jul 1, 2018
@@ -36,6 +36,9 @@ def create_event_with_details(event):
Creates and returns event with passed name and dates
"""
e1 = Event(name=event[0], start_date=event[1], end_date=event[2])
Copy link

@ayushgarg1804 ayushgarg1804 Jul 2, 2018

Choose a reason for hiding this comment

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

Instead of modifying attributes afterwards won't it be a better practice to pass it during Event init itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the hacky way you suggested in meeting so that only 1 test is changed otherwise we'll have to modify like every test done till now. Also this will anyhow get changed when we implement dictionaries.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not moving to dicts rightaway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because moving to dictionaries has a lot of dependency and will need existing tests to be completed first so we can tackle all problem at once.

Copy link

@ayushgarg1804 ayushgarg1804 Jul 3, 2018

Choose a reason for hiding this comment

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

You can have a check of len(event) by if else inside which you call the Event constructor as done in b4afaff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay 👍

@anjali-dhanuka
Copy link
Contributor

@Monal5031 As per your comment on my PR, I think you must include these fields in error message function. create locators etc.

@Monal5031
Copy link
Contributor Author

Monal5031 commented Jul 3, 2018

Yup I am, this is a stretch goal for this week. Thanks for reminding again :)
I also have to include fields of other apps too rn its just for event.

naman1901
naman1901 previously approved these changes Jul 4, 2018
@naman1901 naman1901 dismissed their stale review July 4, 2018 15:10

Accidental

@Monal5031 Monal5031 force-pushed the extra-checks-event-app branch from 5853a10 to 13d0db2 Compare July 9, 2018 09:16
@Monal5031 Monal5031 changed the title Add checks for extra field in model create WIP: Add checks for extra field in model create Jul 10, 2018
@Monal5031 Monal5031 force-pushed the extra-checks-event-app branch from 13d0db2 to bbac88d Compare July 11, 2018 18:25
@Monal5031 Monal5031 force-pushed the extra-checks-event-app branch from e3733e3 to 6f84f5a Compare July 17, 2018 19:14
@Monal5031 Monal5031 changed the title WIP: Add checks for extra field in model create Add checks for extra field in model create Jul 17, 2018
@Monal5031
Copy link
Contributor Author

Monal5031 commented Jul 17, 2018

@naman1901 @ayushgarg1804 @MehaKaushik @pavankm The checks for fields in shift app (model checks) will be added in #726 and for administrator in #780 . For admin and volunteer the checks had previously been done in #724 .
Please review this PR.

@Monal5031 Monal5031 force-pushed the extra-checks-event-app branch 2 times, most recently from 4ad80f7 to 13b3af8 Compare July 21, 2018 15:28
naman1901
naman1901 previously approved these changes Jul 24, 2018
Copy link
Contributor

@naman1901 naman1901 left a comment

Choose a reason for hiding this comment

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

Looks good!

@Monal5031 Monal5031 force-pushed the extra-checks-event-app branch from 13b3af8 to f92bc33 Compare July 24, 2018 20:31
@Monal5031
Copy link
Contributor Author

ping @naman1901 @MehaKaushik @ayushgarg1804 Please review.

@ayushgarg1804
Copy link

@Monal5031 there's a test which is failing

@Monal5031
Copy link
Contributor Author

Same thing as in the documentation PR. @ayushgarg1804 will restart it in a bit.

@Monal5031 Monal5031 force-pushed the extra-checks-event-app branch from f92bc33 to f5382d6 Compare July 30, 2018 08:50
@naman1901 naman1901 merged commit 3cd6974 into anitab-org:gsoc18-infra Aug 1, 2018
@Monal5031 Monal5031 deleted the extra-checks-event-app branch August 11, 2018 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Category: Quality Assurance Changes to code or files that improve testing or fixes bugs. Program: GSOC Related to work completed during the Google Summer of Code Program. Type: Enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants