-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
6/Test GrantCategory #9397
6/Test GrantCategory #9397
Changes from all commits
de846cf
890b3a2
6b79ca0
4c475d8
720facf
6ce1de3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -488,7 +488,7 @@ class Meta: | |
) | ||
|
||
in_active_clrs = models.ManyToManyField( | ||
GrantCLR, | ||
"GrantCLR", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be in "" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea... i guess it's for lazy loading to prevent circular import There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that's right @chibie |
||
help_text="Active Grants CLR Round" | ||
) | ||
is_clr_active = models.BooleanField(default=False, help_text=_('CLR Round active or not? (auto computed)')) | ||
|
@@ -885,7 +885,6 @@ def save(self, update=True, *args, **kwargs): | |
|
||
self.clr_prediction_curve = self.calc_clr_prediction_curve | ||
self.clr_round_num = self.calc_clr_round_label | ||
|
||
self.search_vector = ( | ||
SearchVector('title', weight='A') + SearchVector('description', weight='B') | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import factory | ||
from grants.models.grant_category import GrantCategory | ||
|
||
|
||
class GrantCategoryFactory(factory.django.DjangoModelFactory): | ||
"""Create mock GrantCategory for testing.""" | ||
|
||
class Meta: | ||
model = GrantCategory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
from grants.models.grant_category import GrantCategory | ||
|
||
from .factories.grant_category_factory import GrantCategoryFactory | ||
|
||
|
||
@pytest.mark.django_db | ||
class TestGrantCategory: | ||
"""Test GrantCategory model.""" | ||
|
||
def test_creation(self): | ||
"""Test GrantCategory returned by factory is valid.""" | ||
|
||
grant_category = GrantCategoryFactory() | ||
|
||
assert isinstance(grant_category, GrantCategory) | ||
|
||
def test_grant_category_has_a_category(self): | ||
"""Test 'category' attribute is present.""" | ||
|
||
grant_category = GrantCategoryFactory() | ||
|
||
assert hasattr(grant_category, 'category') |
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.
Oh this is def needed piece ! @chibie
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.
oh shit! all my polygon backend changes in former models.py (https://github.com/gitcoinco/web/blob/5901de79753445f0c76cd406f49154186e0e80d7/app/grants/models.py) are missing from contribution.py in master!! 😕
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.
@chibie Oh no! I thought I had updated it with all the changes 😞