Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Remove celery pingdom checks
Browse files Browse the repository at this point in the history
  • Loading branch information
PippoRaimondiDIT committed Jun 4, 2024
1 parent 34a0156 commit 65a5648
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions app/pingdom/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from rest_framework.reverse import reverse
from redis.exceptions import RedisError

from app.pingdom.services import CheckCelery, CheckDatabase, CheckRedis
from app.pingdom.services import CheckDatabase, CheckRedis
from app.pingdom.views import ping


Expand All @@ -17,11 +17,9 @@

class ServiceHealthCheckPingdomTestCase(test_dh_utils.DataHubUtilsTests):
@patch.object(CheckDatabase, 'check')
@patch.object(CheckCelery, 'check')
@patch.object(CheckRedis, 'check')
def test_ping_success(self, check_database, check_celery, check_redis):
def test_ping_success(self, check_database, check_redis):
check_database.return_value = (True, "")
check_celery.return_value = (True, "")
check_redis.return_value = (True, "")

response = ping({})
Expand All @@ -40,17 +38,6 @@ def test_ping_failure(self, check_database):
assert '<!--Error message-->' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

@patch.object(CheckCelery, 'check')
def test_all_good(self, check_celery):
"""Fake Celery for Circle CI"""
check_celery.return_value = (True, "")
url = reverse('ping')
response = self.client.get(url)

assert response.status_code == status.HTTP_200_OK
assert '<status>OK</status>' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

def test_check_database_fail(self):
url = reverse('ping')

Expand All @@ -64,18 +51,6 @@ def test_check_database_fail(self):
assert '<status>FALSE</status>' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

def test_check_celery_fail(self):
url = reverse('ping')
with patch(
'app.enquiries.celery.app.control.inspect.stats',
return_value=None
):
response = self.client.get(url)

assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
assert '<status>FALSE</status>' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

def test_check_redis_fail(self):
url = reverse('ping')
with patch(
Expand Down

0 comments on commit 65a5648

Please sign in to comment.