526 contrasting confirmation messages#571
Conversation
…n_Messages merging my changes with development
bakobagassas
left a comment
There was a problem hiding this comment.
Why are we changing 6 test files ? I don't think most of those changes are necessary
I had to make those changes because they(the test files) were failing as a result of the new changes I added. |
|
Your tests now handle success cases, but could you consider adding an integration test for partial/full submission failure scenarios after you have added the fixes mentioned above? |
Since the main change in this pr was to put everything inside a mainDB.atomic block so that a form would not get submitted if email sending fails i do not think that it would be necessary testing the mainDB.atomic() block since that is peewee's behavior. |
| formHistory = FormHistory.create( formID = lsf.laborStatusFormID, | ||
| historyType = "Labor Status Form", | ||
| overloadForm = None, | ||
| createdBy = creatorID, |
There was a problem hiding this comment.
shouldn't the email.laborStatusFormSubmitted be here?
There was a problem hiding this comment.
Yes, the call is intentionally handled later in the flow. For overload forms, the email is triggered earlier on line 81 via email.LaborOverloadFormSubmitted(link) and for regular status forms, the emaila gets sent on line 91 after the FormHistory record is created.
| @@ -1,8 +1,9 @@ | |||
| from app import app | |||
There was a problem hiding this comment.
Can I know the rationale for this as working on init.py file affect most of the backend
There was a problem hiding this comment.
I added these lines to resolve a circular import issue where other files depended on the db instance from this file. At the time, those modules were being imported before the database had been properly initialized, which led to errors when accessing db. Importing the Flask app and initializing db with it ensured that the database instance was available when those modules were loaded.
Fixes issue #526
Changes:
Testing: