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

refactor views to provide serializer_valid and serializer_invalid as … #413

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ralokt
Copy link

@ralokt ralokt commented Dec 28, 2017

…hooks for subclasses.

I'm using this app for a project of my own, and wanted to set user.last_login.

I felt like what I had to do to accomplish this wasn't very DRY, as I had to re-serialize the request data in order to get to the user.

So I decided to factor that out in a manner reminicient of the form_valid and form_invalid methods of Django's generic views.

@codecov
Copy link

codecov bot commented Dec 29, 2017

Codecov Report

Merging #413 into master will decrease coverage by 0.28%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #413      +/-   ##
==========================================
- Coverage   90.67%   90.38%   -0.29%     
==========================================
  Files          14       12       -2     
  Lines         847      822      -25     
  Branches       29       29              
==========================================
- Hits          768      743      -25     
  Misses         66       66              
  Partials       13       13
Flag Coverage Δ
#codecov 90.38% <76.92%> (-0.29%) ⬇️
#dj110 87.1% <76.92%> (-0.39%) ⬇️
#dj111 87.1% <76.92%> (-0.39%) ⬇️
#dj18 89.53% <76.92%> (-0.31%) ⬇️
#dj19 89.53% <76.92%> (-0.31%) ⬇️
#drf31 89.53% <76.92%> (-0.31%) ⬇️
#drf32 89.53% <76.92%> (-0.31%) ⬇️
#drf33 89.53% <76.92%> (-0.31%) ⬇️
#drf34 90.38% <76.92%> (-0.29%) ⬇️
#drf35 90.02% <76.92%> (-0.3%) ⬇️
#drf36 90.02% <76.92%> (-0.3%) ⬇️
#py27 90.38% <76.92%> (-0.29%) ⬇️
#py33 89.17% <76.92%> (-0.32%) ⬇️
#py34 90.02% <76.92%> (+0.53%) ⬆️
#py35 87.1% <76.92%> (?)
#py36 87.1% <76.92%> (?)
Impacted Files Coverage Δ
rest_framework_jwt/views.py 93.18% <76.92%> (+0.68%) ⬆️
rest_framework_jwt/utils.py
rest_framework_jwt/models.py

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a0bd40...52c8b7b. Read the comment docs.

@ralokt
Copy link
Author

ralokt commented Jan 16, 2018

I'm aware that this pull request decreases code coverage as currently measured.

However, this is the case because of refactoring for flexibility, not because I introduce any new behavior; I looked at the existing tests, they all seem to test views as a whole, and I don't see how I could contribute tests that cover my changes (although I'm open to suggestions!).

Also, #410 is evidence that I'm not alone in wanting something like this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant