def refresh(self, refresh_token: str) -> dict:

        session = Auth.get_session(refresh_token)
        admin = Admin.query.filter_by(id=session["id"]).first()
        data = AdminCreateSchema().dump(admin)
        tokens = Auth.update_session(refresh_token, **data)

        return tokens
    def test_update_session(self):

        with patch("app.src.common.auth.Auth.generate_session_token",
                   return_value=dict()):
            with patch("app.src.common.auth.config.redis",
                       new=self.mock_redis) as mock:
                data = dict(name="test", id=1)
                refresh = "refresh_token"
                new_session = Auth.update_session(refresh, **data)

                mock.hget.assert_any_call(REFRESH_TOKEN_KEY + refresh,
                                          "session")
                mock.hget.assert_any_call(self.role, "ROLE")
                mock.delete.assert_any_call(REFRESH_TOKEN_KEY + refresh)
                mock.delete.assert_any_call(self.role)

        self.assertDictEqual(new_session, dict())