Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

[utils] Add error handling in csvfile validation #252

Merged
merged 3 commits into from
Nov 21, 2019

Conversation

Aviral14
Copy link
Contributor

Fixes #251

@Aviral14 Aviral14 force-pushed the issues/251 branch 2 times, most recently from 782122a to 0c4baf3 Compare November 19, 2019 15:57
@coveralls
Copy link

coveralls commented Nov 19, 2019

Coverage Status

Coverage increased (+0.0002%) to 99.926% when pulling d48d1fc on Aviral14:issues/251 into edd0ba6 on openwisp:master.

@atb00ker atb00ker added this to To do (general) in OpenWISP Contributor's Board via automation Nov 20, 2019
@atb00ker atb00ker moved this from To do (general) to Needs review in OpenWISP Contributor's Board Nov 20, 2019
atb00ker
atb00ker previously approved these changes Nov 20, 2019
Copy link
Member

@atb00ker atb00ker left a comment

Choose a reason for hiding this comment

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

Great. Thanks! 👍

OpenWISP Contributor's Board automation moved this from Needs review to In progress Nov 20, 2019
@atb00ker atb00ker moved this from In progress to Needs review in OpenWISP Contributor's Board Nov 20, 2019
OpenWISP Contributor's Board automation moved this from Needs review to In progress Nov 20, 2019
@Aviral14
Copy link
Contributor Author

@atb00ker All checks have passed now!

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

@Aviral14 Thanks for contributing! See my comments below.

improper_csv_path = self._get_path('static/test_batch_improper.csv')
invalid_csv_path = self._get_path("static/test_batch_invalid.csv")
improper_csv_path = self._get_path("static/test_batch_improper.csv")
invalid_format_path = self._get_path("static/test_batch_invalid_format.pdf")
Copy link
Member

Choose a reason for hiding this comment

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

I think this test method is becoming too big, can you please write a new test method with the assertions you have added?

Another suggestion: please keep the changes to minimum, do not edit lines that are not bugged, right now I see you're changing a lot of single quotes to double quotes, which even if it's good for consistency, adds noise and makes the work of the reviewers harder. Those kind of clean up changes should be done separately if you really want to do it (clean up is welcome in my opinion).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nemesisdesign ok I will try to write a completely new method for testing the validation of csv files.
Actually,my formatter was automatically doing these cleanup changes you mentioned.I will remember not to do any kind of edits in non-buggy lines!

@nemesifier
Copy link
Member

PS: please also rebase your branch on the current master.

@nemesifier
Copy link
Member

@Aviral14 ping me when ready for review

Fixes openwisp#251
1.Add try except blocks to catch the error
2.Add test for the same
3.Use ugettext_lazy
4.Fix Formatting in utils file
5.Create separate method to validate file format
@Aviral14
Copy link
Contributor Author

@nemesisdesign Please Review!

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

Thanks 👍

PS: I edited the error message, "Try again" is not a good suggestion in this case because it may be misinterpreted. You should use "Try again" in an error message only if there's a temporary server or network issue, because the user may understand that they have to try again repeating the same operation, which in this case won't work.

@nemesifier nemesifier merged commit e960328 into openwisp:master Nov 21, 2019
OpenWISP Contributor's Board automation moved this from In progress to Done Nov 21, 2019
@Aviral14 Aviral14 deleted the issues/251 branch November 21, 2019 18:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Form error on "Add batch user creation"
4 participants