blb-ventures / strawberry-django-plus

Enhanced Strawberry GraphQL integration with Django
MIT License
179 stars 47 forks source link

Fix hard dependencies on contenttypes and auth framework, fixes #248 , #249 #250

Closed devkral closed 1 year ago

devkral commented 1 year ago

fixes #248 , #249

The tests are deeply integrated with User so I cannot provide tests or have you an idea? Would it be sufficient to change the settings via decorator/context and then do import tests (I think not as the modules are already imported)

devkral commented 1 year ago

I think, I get why UserType exists.

AbstractBaseUser lacks some attributes (PermissionMixin).

But the dependency can still be made optional

codecov[bot] commented 1 year ago

Codecov Report

Merging #250 (a4877fd) into main (8878561) will decrease coverage by 0.12%. The diff coverage is 84.31%.

@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
- Coverage   88.48%   88.36%   -0.12%     
==========================================
  Files          28       28              
  Lines        2830     2846      +16     
==========================================
+ Hits         2504     2515      +11     
- Misses        326      331       +5     
Impacted Files Coverage Δ
strawberry_django_plus/permissions.py 82.59% <66.66%> (ø)
strawberry_django_plus/utils/query.py 82.71% <82.60%> (-3.40%) :arrow_down:
strawberry_django_plus/integrations/guardian.py 94.44% <85.71%> (+0.15%) :arrow_up:
strawberry_django_plus/optimizer.py 87.00% <85.71%> (-0.17%) :arrow_down:
strawberry_django_plus/type.py 89.50% <100.00%> (+0.11%) :arrow_up:
strawberry_django_plus/utils/typing.py 88.88% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

devkral commented 1 year ago

I worked around the problems and fixed the problem that mixing 3party users with internal users could causes crashes in is_staff, is_superuser checks

devkral commented 1 year ago

I have some problems with pyupgrade and pyright. It will incorrectly upgrade some if TYPE_CHECKING clauses.

On the other hand pyright does not accept None, therefor the type(None) clauses

devkral commented 1 year ago

sry for the noise, running pyright locally gives different results. Shall I rebase?

bellini666 commented 1 year ago

@devkral sure, rebase or merge the main branch, it will get squashed later so only the diff matters :)

Ping me when this is ready for the next review

devkral commented 1 year ago

cleaned up and rebased

devkral commented 1 year ago

the issues are fixed

bellini666 commented 1 year ago

@devkral thanks for putting the time for this and to fix all the review comments :)