-
Notifications
You must be signed in to change notification settings - Fork 192
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
Create factories and tests for the entities #538
Conversation
✅ Deploy Preview for activist-org canceled.
|
Thank you for the pull request!The activist team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :) If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Development rooms once you're in. It'd be great to have you! Maintainer checklist
|
@marcosquadross thank you for the work you put into this 🚀 . I will check the PR in the next days. Btw, the backend workflow fails because of static type checking, but this is not an issue. |
@andrewtavis since there are a lot of reference to other factories (subfactories), we need to wait till the rest of the factories are done, before we can properly test if it works. I would say we can merge this after the change request and than keep the issue open. |
Yes I'll merge later, @to-sta :) |
@marcosquadross I made some minor adjustments. Thanks for your work on this 😃 |
backend/entities/factory.py
Outdated
|
||
class OrganizationFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model: Organization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcosquadross saw a typo here, model should be assigned to Organization. Generally I would recommand you to test your implementation. When you run pytest, you would see that it fails.
class Meta:
model = Organization
You can also use the django shell (python manage.py shell
) to test your factories.
backend/entities/tests.py
Outdated
|
||
# Create your tests here. | ||
@pytest.mark.django_db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you use the build()
method you do not need the db marker 😉. It's needed for the create method, with build you aren't creating entries in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the work here, @marcosquadross! Hope we can work with you again soon 😊 And thanks for the review, @to-sta!
Contributor checklist
Description
This PR create a new file with de entitites factory and add the tests.
Related issue
Create factories and tests for the entities app in the backend #508