Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jer-Sch committed Sep 22, 2021
1 parent 5e928ab commit 4257261
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions app/grants/tests/test_grant_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,37 @@ def test_creation(self):
assert isinstance(grant_type, GrantType)

def test_grant_type_has_a_name(self):
"""Test 'name' attribute."""
"""Test 'name' attribute is present."""

grant_type = GrantTypeFactory()

assert hasattr(grant_type, 'name')
assert grant_type.name == ''

def test_grant_type_has_a_label(self):
"Test 'label' attribute."
"Test 'label' attribute is present."

grant_type = GrantTypeFactory()

assert hasattr(grant_type, 'label')
assert grant_type.label == None

def test_grant_type_has_a_is_active_attribute(self):
"Test 'is_active' attribute and default value."
"Test 'is_active' attribute is present and defaults to True."

grant_type = GrantTypeFactory()

assert hasattr(grant_type, 'is_active')
assert grant_type.is_active == True

def test_grant_type_has_a_is_visible_attribute(self):
"Test 'is_visible' attribute and default value."
"Test 'is_visible' attribute is present and defaults to True."

grant_type = GrantTypeFactory()

assert hasattr(grant_type, 'is_visible')
assert grant_type.is_visible == True

def test_grant_type_has_many_categories(self):
"Test relation to GrantCategory."
def test_grant_type_has_associated_categories(self):
"Test 'categories' arribute is present and can be more than one."

grant_categories = (GrantCategoryFactory(), GrantCategoryFactory())

Expand All @@ -67,12 +65,11 @@ def test_grant_type_has_many_categories(self):
assert isinstance(grant_type.categories.first(), GrantCategory)

def test_grant_type_has_a_logo(self):
"""Test 'logo' attribute."""
"""Test 'logo' attribute is present."""

grant_type = GrantTypeFactory()

assert hasattr(grant_type, 'logo')
assert grant_type.logo == None

def test_clrs_method_calls_collaborator_with_appropriate_parameters(self):
"""Test GrantType.clrs method calls filter on GrantCLR.objects with appropriate parameters."""
Expand All @@ -94,7 +91,6 @@ def test_active_clrs_method_calls_collaborator_with_appropriate_parameters(self)

filter.assert_called_with(is_active=True, grant_filters__grant_type=str(grant_type.pk))


def test_grant_type_has_active_clrs_sum_method(self):
"""Test GrantType.active_clrs_sum method."""

Expand Down

0 comments on commit 4257261

Please sign in to comment.