-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Medhat Gayed
committed
Jan 22, 2018
1 parent
a5fa5aa
commit d9b1463
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |