Skip to content

Can not create inactive user. #207

@Oli4

Description

@Oli4

First of all, thank you very much for sharing this project. I already learned a lot by building my first API based on this template.

When I looked at the test cases I was wondering about the intention of the following test. I thought it is about creating an inactive user but the UserCreate schema does not accept an attribute disabled. The respective attribute is is_active. The logic also does not make sense to me except this test intention is to show that you can not create an inactive user. Otherwise, it should be assert not is_active. But then the test fails even if you replace the disabled with is_active

https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/45fdd880ce8a6fff70ff057d7e0fa4918a35cb06/%7B%7Bcookiecutter.project_slug%7D%7D/backend/app/app/tests/crud/test_user.py#L45-L51

It turns out that CRUDUser.create ignores is_active.

https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/45fdd880ce8a6fff70ff057d7e0fa4918a35cb06/%7B%7Bcookiecutter.project_slug%7D%7D/backend/app/app/crud/crud_user.py#L15-L21

If it is intended that you can not create an inactive user than the User Schemas should be altered such that the is_active attribute is not optional for UserCreate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions