Skip to content

Commit

Permalink
- Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Dec 11, 2019
1 parent ce93edc commit 7805ae3
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions geonode/layers/tests.py
Expand Up @@ -363,7 +363,7 @@ def test_layer_links(self):

links = Link.objects.filter(resource=lyr.resourcebase_ptr, link_type="image")
self.assertIsNotNone(links)
self.assertEqual(len(links), 9)
self.assertEqual(len(links), 8)

def test_get_valid_user(self):
# Verify it accepts an admin user
Expand Down Expand Up @@ -822,29 +822,27 @@ def testJSONField(self):
ValidationError,
lambda: field.clean('<users></users>'))

# AF: This causing Segmentation Fault
# def test_rating_layer_remove(self):
# """ Test layer rating is removed on layer remove
# """
# # Get the layer to work with
# layer = Layer.objects.all()[3]
# layer_id = layer.id

# # Create the rating with the correct content type
# ctype = ContentType.objects.get(model='layer')
# from pinax.ratings.models import OverallRating
# OverallRating.objects.create(
# category=2,
# object_id=layer_id,
# content_type=ctype,
# rating=3)
# rating = OverallRating.objects.all()
# self.assertEqual(rating.count(), 1)
# # Remove the layer
# layer.delete()
# # Check there are no ratings matching the remove layer
# rating = OverallRating.objects.all()
# self.assertEqual(rating.count(), 0)
def test_rating_layer_remove(self):
""" Test layer rating is removed on layer remove
"""
# Get the layer to work with
layer = Layer.objects.all()[3]
layer_id = layer.id

# Create the rating with the correct content type
ctype = ContentType.objects.get(model='layer')
OverallRating.objects.create(
category=2,
object_id=layer_id,
content_type=ctype,
rating=3)
rating = OverallRating.objects.all()
self.assertEqual(rating.count(), 1)
# Remove the layer
layer.delete()
# Check there are no ratings matching the remove layer
rating = OverallRating.objects.all()
self.assertEqual(rating.count(), 0)

def test_layer_remove(self):
"""Test layer remove functionality
Expand Down

0 comments on commit 7805ae3

Please sign in to comment.