Closed Bug 1390155 Opened 9 years ago Closed 9 years ago

test_alert_summary_post() should use the test_user and test_sheriff pytest fixtures

Categories

(Tree Management :: Perfherder, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: omakkila, Mentored)

Details

(Keywords: good-first-bug, Whiteboard: [lang=py])

Attachments

(1 file)

Currently `test_alert_summary_post()` manually creates test users to check the API authentication behaviour: https://github.com/mozilla/treeherder/blob/86dea95c67e7c19ac557d19c629263fa13619fbc/tests/webapp/api/test_performance_alertsummary_api.py#L191-L203 Instead, it should use the existing `test_user` and `test_sheriff` Pytest fixtures, like the test above it does: https://github.com/mozilla/treeherder/blob/86dea95c67e7c19ac557d19c629263fa13619fbc/tests/webapp/api/test_performance_alertsummary_api.py#L145-L146 https://github.com/mozilla/treeherder/blob/86dea95c67e7c19ac557d19c629263fa13619fbc/tests/webapp/api/test_performance_alertsummary_api.py#L155 To fix this: 1) Set up a Vagrant environment (https://treeherder.readthedocs.io/installation.html) 2) Remove the User.objects.create() calls in that test 3) Add the test_user and test_sheriff fixtures to the test function definition and switch the `client.force_authenticate()` calls to use the fixture rather than `user`. 4) Run the test locally to check all working (https://treeherder.readthedocs.io/common_tasks.html#running-tests) 5) Open a PR with title of form "Bug NNNNNN - <description>" 6) Mark the resulting attachment in this bug (that a bot will create) as "review?" to one of the suggested reviewers. Good luck!
Hello! Mind if I work on this bug? I've previously provided a patch (bug 1378935) located in the same repo. Thanks!
Sure! If you have any questions just ask :-)
Comment on attachment 8898956 [details] [review] [treeherder] omakk:1390155-use-fixtures > mozilla:master For some reason I am unable to flag the attachment for review. Do I need to be assigned first before I can flag for review?
(In reply to Omar Akkila from comment #4) > Comment on attachment 8898956 [details] [review] > [treeherder] omakk:1390155-use-fixtures > mozilla:master > > For some reason I am unable to flag the attachment for review. Do I need to > be assigned first before I can flag for review? You need editbugs permissions to change the flags on an attachment you didn't submit (in this case it was the autolander bot who submitted). Instructions for applying for them here: https://wiki.mozilla.org/BMO/UserGuide#How_to_apply_for_upgraded_permissions
Comment on attachment 8898956 [details] [review] [treeherder] omakk:1390155-use-fixtures > mozilla:master This lgtm
Attachment #8898956 - Flags: review+
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/d5debf3000de54ebef983e6daca9897c5f19032f Bug 1390155 - Make test_alert_sumary_post() use test_user and test_sheriff pytest fixtures (#2720)
Thank you for the patch, I went ahead and reviewed + merged it.
Assignee: nobody → omakkila
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: