Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Create staff fixture #2928

Merged
merged 3 commits into from
Nov 6, 2023
Merged

feat: Create staff fixture #2928

merged 3 commits into from
Nov 6, 2023

Conversation

zachaysan
Copy link
Contributor

@zachaysan zachaysan commented Nov 6, 2023

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Add a new fixture to transition to testing more routes by default at a lower level of access to ensure staff members are:

  1. Able to do stuff they're supposed to do.
  2. Not able to do stuff they're not supposed to do.

Essentially, start by default by using the staff fixture since the resulting tests are more robust since admin users are automatically able to sail through most permissions classes.

How did you test this code?

By using the same code in this PR

Copy link

vercel bot commented Nov 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 6:16pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 6:16pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 6:16pm

Copy link
Contributor

github-actions bot commented Nov 6, 2023

Uffizzi Preview deployment-40139 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (6e6a48b) 95.63% compared to head (5ad077f) 95.62%.
Report is 6 commits behind head on main.

❗ Current head 5ad077f differs from pull request most recent head c6d00ec. Consider uploading reports for the commit c6d00ec to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2928      +/-   ##
==========================================
- Coverage   95.63%   95.62%   -0.01%     
==========================================
  Files        1011     1011              
  Lines       29006    29015       +9     
==========================================
+ Hits        27741    27747       +6     
- Misses       1265     1268       +3     
Files Coverage Δ
api/conftest.py 97.60% <70.00%> (-1.16%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@khvn26 khvn26 requested review from a team and kyle-ssg and removed request for malthauser and kyle-ssg November 6, 2023 15:52
Copy link
Member

@khvn26 khvn26 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, two concerns though:

  1. I'd think on the naming some more since, AFAIK, we don't use the word "staff" anywhere. user_user is awkward of course, maybe user_role_user is better.
  2. I'm reluctant to merge this without any tests actually using the fixture to avoid adding dead code.

@zachaysan
Copy link
Contributor Author

  1. I'd think on the naming some more since, AFAIK, we don't use the word "staff" anywhere. user_user is awkward of course, maybe user_role_user is better.

I bounced it off Matt and he's with me on staff being a sorta concise, readable word. I think it's better than the alternatives.

  1. I'm reluctant to merge this without any tests actually using the fixture to avoid adding dead code.

I already have some tests that use this fixture. They're just in PRs that may be around for a while and I want this new fixture to use now. Plus we should all be defaulting to using this fixture anyway, since the admin client side steps many of the permissions checks.

@zachaysan zachaysan added this pull request to the merge queue Nov 6, 2023
Merged via the queue into main with commit a09436d Nov 6, 2023
@zachaysan zachaysan deleted the feat/add_staff_fixture branch November 6, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants