-
Notifications
You must be signed in to change notification settings - Fork 4
Test for view /shift/view_volunteer_shifts/
failing
#35
Comments
@jayesh92 Thanks for opening an issue. Nice sharing of knowledge and teamwork. Some quick tips for all on issue communications:
I'm going to reformat the original issue to see if I have understanding of the issue. |
The functional test "check if admin can access a volunteer view" is failing. The test can be viewed at jayesh92@45a3993#diff-0df96ededa86aa47a9dbdb5655a6908aR177 . I've created an admin account and tried to browse url /shift/view_volunteer_shifts/1 which is meant to be a volunteer view. I get a 500 error instead of 403. The code for view being tested is https://github.com/systers/vms/blob/develop/vms/shift/views.py#L285 . Suggestions: The problem here is at line 290, since it's an admin account it's volunteer field will be None and we can't access its 'id'. It would be better if we first check if its not a volunteer and then raise a 403 or better we create a decorator to check admin and use this for all volunteer views. [My reformatting of @jayesh92's original issue with two minor edits] |
Questions on the vms project functionality:
My recommendation, before addressing the testing issue, would be to address these questions and create a docstring for the function (view_volunteer_shifts) to clarify expected behavior of the function. After that, I recommend @vubo and @jayesh92 work together to determine if the desired behaviors are being covered properly by functional tests and create a plan to do so. Thanks! |
@Nerdylicious can tell more about the desired functionality about this issue. |
Hi everyone,
|
Thank you @jayesh92 for opening an issue. I will get around to it. This part is also in my timeline (22 June-19 July). @rosariorobinson could you tell please, can admins also be volunteers? And if yes, what should happen if an admin is also a volunteer? |
@jayesh92 I'm reviewing open issues. I noticed that your travis.yml file is using Python 2.7. We are currently using Python 3.4 for development. You may wish to add that to your travis file. |
@willingc I'll add that |
Thanks @jayesh92. It may help catch some issues sooner versus later. Also Travis can test both Python versions if desired. |
@willingc We can configure travis to run for PY2 and PY3. I guess it would be good to do so once we have a good compatibility file to take care of differences in coding practices of PY2 and PY3 |
@vubo ... Yes, admins can be volunteers. Because they are admins, they should still be able to visit a volunteer job/position and sign up as they were just a volunteer. I think I see admins as just a different view than others with additional functionality. They should be able to view VMS as a volunteer as well. Let me know if you need more clarity. |
fine by my side |
Thanks @jayesh92 :) |
I'm writing test to check if admin can access a volunteer view or not, but the build fails. The test can be viewed at jayesh92/vms@45a3993#diff-0df96ededa86aa47a9dbdb5655a6908aR177 . I've created an admin account and tried to browse url
/shift/view_volunteer_shifts/1
which is meant to be a volunteer view. I get a500
error instead of403
. The code for view being tested is https://github.com/systers/vms/blob/develop/vms/shift/views.py#L285 . The problem here is at line 290, since it's an admin account it'svolunteer
field will beNone
and we can't access its 'id'. It would be better if we first check if its not a volunteer and then raise a403
or better we create a decorator to check admin and use this for all volunteer views.@Nerdylicious @willingc @vubo
The text was updated successfully, but these errors were encountered: