Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jer-Sch committed Sep 27, 2021
1 parent 88d21c4 commit d34b226
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/grants/tests/models/factories/flag_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ class Meta:

grant = factory.SubFactory(GrantFactory)
profile = factory.SubFactory(ProfileFactory)
comments = 'Test comment'
comments = ''
19 changes: 9 additions & 10 deletions app/grants/tests/models/test_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,52 @@ def test_creation(self):

assert isinstance(flag, Flag)

def test_flag_belongs_to_grant(self):
"""Test relation of Flag to associated Grant."""
def test_flag_has_associated_grant(self):
"""Test 'grant' attribute is present and is an instance of Grant."""

flag = FlagFactory()

assert hasattr(flag, 'grant')
assert isinstance(flag.grant, Grant)

def test_flag_belongs_to_profile(self):
"""Test relation of Flag to associated Profile and default value."""
def test_flag_has_associated_profile(self):
"""Test 'profile' attribute is present and is an instance of Profile."""

flag = FlagFactory()

assert hasattr(flag, 'profile')
assert isinstance(flag.profile, Profile)

def test_flag_has_comments(self):
"""Test 'comments' attribute and default value."""
"""Test 'comments' attribute is present."""

flag = FlagFactory()

assert hasattr(flag, 'comments')
assert flag.comments == 'Test comment'
assert flag.comments == ''

def test_flag_has_processed_attribute(self):
"""Test 'processed' attribute and default value."""
"""Test 'processed' attribute is present and defaults to False."""

flag = FlagFactory()

assert hasattr(flag, 'processed')
assert flag.processed == False

def test_flag_has_comments_admin(self):
"""Test 'comments_admin' attribute and default."""
"""Test 'comments_admin' attribute is present and defaults to empty string."""

flag = FlagFactory()

assert hasattr(flag, 'comments_admin')
assert flag.comments_admin == ''

def test_flag_has_tweet_attribute(self):
"""Test 'tweet' attribute."""
"""Test 'tweet' attribute is present."""

flag = FlagFactory()

assert hasattr(flag, 'tweet')
assert flag.tweet == ''

def test_post_flag_method_calls_collaborators_with_appropriate_attributes(self):
"""Test post_flag() method calls filter() on Profile.objects, create() on Activity.objects, and create() on Comment.objects."""
Expand Down

0 comments on commit d34b226

Please sign in to comment.