Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change users models #66

Merged
merged 12 commits into from
Nov 26, 2021
Merged

Conversation

AvivLiberman
Copy link
Collaborator

Fixes #61

Django default user already has email, first_name, last_name.
I removed those 3 fields from our User and .

Changes you made

  • removed those 3 fields from our User
  • created a static method that will create our user with all required fields
  • added tests for creating team and user

from now on we must write tests for each PR

Django default user already has email, first_name, last_name.
I removed those 3 fields from our User and created a static method that will create our user with all required fields.
Also included some tests - from now on we must write tests for each PR
I saw that django generates in the DB _id for each field that is foreign key. Better to remove it now.
Copy link
Collaborator

@orzionpour orzionpour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the dummy test? we don't need it anymore since there are real tests now.

tasks/models.py Show resolved Hide resolved
tasks/models.py Outdated Show resolved Hide resolved
@orzionpour
Copy link
Collaborator

As for the test and functions:
Django has more functions like delete user, change password, etc.. Since we are using another users table we should implement another function that updates both tables. For example, our delete function should call django's delete so we can do it directly from our table. Correct me if i go wrong here
In addition, I guess we need change_team and change_role functions.

@AvivLiberman
Copy link
Collaborator Author

I don't want that PR to be big. Any other ideas you have to add more functionality open an issue about it

Asafh7
Asafh7 previously approved these changes Nov 22, 2021
- Change tests to pytest
- Removed dummy test
- Create factory for tests
On admin panel first_name no longer exists so it failed. Changed it to take the username from auth user.
orzionpour
orzionpour previously approved these changes Nov 23, 2021
tasks/models.py Outdated Show resolved Hide resolved
Asafh7
Asafh7 previously approved these changes Nov 23, 2021
orzionpour
orzionpour previously approved these changes Nov 23, 2021
@natifridman
Copy link
Contributor

Why conftest.py need to be in the main folder?

- removed conftest.py
- added tests in classes
- changed models realated_name
@AvivLiberman
Copy link
Collaborator Author

Why conftest.py need to be in the main folder?

you are right - I removed it

Asafh7
Asafh7 previously approved these changes Nov 25, 2021
orzionpour
orzionpour previously approved these changes Nov 25, 2021
orzionpour
orzionpour previously approved these changes Nov 26, 2021
removed email from test_create_user_without_email
added long name to test_create_user_with_long_name
@natifridman natifridman merged commit 37b1e4f into redhat-beyond:main Nov 26, 2021
orzionpour added a commit to orzionpour/falcon that referenced this pull request Nov 26, 2021
This was referenced Nov 26, 2021
orzionpour added a commit to orzionpour/falcon that referenced this pull request Nov 26, 2021
mgold1234 pushed a commit that referenced this pull request Nov 29, 2021
* Fix merge between PRs

- Fix merge between #66 and #72

* Create conftest.py

- Create conftest.py for reusable fixtures

* Add change_assignee function

- Add change_assignee function to Task model.
- Add tests for change_assignee

* Refactor conftest.py

- Removed use of Random to prevent unexpected behavior in tests.
- Changed to named parameters in user creations.

* Handle special cases

- Add new tests to validate the correctness of the function in special cases.

* Fix flake8 error

* Update change_assignee

- Add new user case handling: new_assignee is a user but not part of the system (not in DB)
- Add corresponding test

* Refactor conftest.py

* Refactor conftest.py

* Refactor test_change_assignee.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create tests for users
6 participants