Skip to content

Commit

Permalink
fixed failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
eadwinCode committed Nov 8, 2023
1 parent 36ef232 commit 8187b5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ninja_jwt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ def post_validate_schema(cls, values: Dict) -> dict:

return values

def get_response_schema_init_kwargs(self) -> dict:
return dict(
self.dict(exclude={"password"}), **self.__dict__.get("token_data", {})
)

def to_response_schema(self):
_schema_type = self.get_response_schema()
return _schema_type(
**self.dict(exclude={"password"}), **self.__dict__.get("token_data", {})
)
return _schema_type(**self.get_response_schema_init_kwargs())


class TokenObtainPairOutputSchema(AuthUserSchema):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_custom_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def to_response_schema(self):
return MyNewObtainTokenSlidingSchemaOutput(
first_name=self._user.first_name,
last_name=self._user.last_name,
**self.dict(exclude={"password"}),
**self.get_response_schema_init_kwargs(),
)


Expand Down

0 comments on commit 8187b5a

Please sign in to comment.