Skip to content

Commit

Permalink
Test unexpected number of workers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Medhat Gayed committed Jan 22, 2018
1 parent a5fa5aa commit d9b1463
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.core.management import call_command
from django.test import TestCase
import mock
from django.conf import settings
from django_rq_pulse.management.commands import rq_pulse_check

@mock.patch.object(rq_pulse_check, 'send_mail')
@mock.patch.object(settings, 'DEFAULT_FROM_EMAIL', 'sample_from@email.com')
@mock.patch.object(settings, 'ADMINS', ['sample_admin@email.com'])
class RQPulseCheckTestCase(TestCase):
def test_number_of_workers_is_not_expected(self, mock_send_mail):
call_command('rq_pulse_check')
mock_send_mail.assert_called_with(
'WARNING: RQ Workers maybe down!',
'The number of workers 0 does not equal the expected number 2. Workers maybe down.',
'sample_from@email.com', ['sample_admin@email.com'])

0 comments on commit d9b1463

Please sign in to comment.