mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 01:13:31 +01:00
PEP-8 fixes
This commit is contained in:
parent
bf344b09b1
commit
47f3eb8e89
@ -387,7 +387,7 @@ def ticket_from_message(message, queue, logger):
|
|||||||
all_users = User.objects.all()
|
all_users = User.objects.all()
|
||||||
all_user_emails = set([x.email for x in all_users])
|
all_user_emails = set([x.email for x in all_users])
|
||||||
users_not_currently_ccd = all_user_emails.difference(set(current_cc))
|
users_not_currently_ccd = all_user_emails.difference(set(current_cc))
|
||||||
users_to_cc = cc.intersection( users_not_currently_ccd )
|
users_to_cc = cc.intersection(users_not_currently_ccd)
|
||||||
for user in users_to_cc:
|
for user in users_to_cc:
|
||||||
tcc = TicketCC.objects.create(
|
tcc = TicketCC.objects.create(
|
||||||
ticket=t,
|
ticket=t,
|
||||||
|
@ -355,6 +355,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
self.assertEqual(attach2.followup.id, 2)
|
self.assertEqual(attach2.followup.id, 2)
|
||||||
self.assertEqual(attach2.filename, 'email_html_body.html')
|
self.assertEqual(attach2.filename, 'email_html_body.html')
|
||||||
|
|
||||||
|
|
||||||
class GetEmailCCHandling(TestCase):
|
class GetEmailCCHandling(TestCase):
|
||||||
"""TestCase that checks CC handling in email. Needs its own test harness."""
|
"""TestCase that checks CC handling in email. Needs its own test harness."""
|
||||||
|
|
||||||
@ -422,7 +423,6 @@ class GetEmailCCHandling(TestCase):
|
|||||||
}
|
}
|
||||||
self.original_cc = TicketCC.objects.create(**cc_kwargs)
|
self.original_cc = TicketCC.objects.create(**cc_kwargs)
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|
||||||
rmtree(self.temp_logdir)
|
rmtree(self.temp_logdir)
|
||||||
@ -457,15 +457,16 @@ class GetEmailCCHandling(TestCase):
|
|||||||
test_mail_len = len(test_email)
|
test_mail_len = len(test_email)
|
||||||
|
|
||||||
with mock.patch('helpdesk.management.commands.get_email.listdir') as mocked_listdir, \
|
with mock.patch('helpdesk.management.commands.get_email.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.management.commands.get_email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.management.commands.get_email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)):
|
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)):
|
||||||
mocked_isfile.return_value = True
|
|
||||||
mocked_listdir.return_value = ['filename1']
|
|
||||||
|
|
||||||
call_command('get_email')
|
mocked_isfile.return_value = True
|
||||||
|
mocked_listdir.return_value = ['filename1']
|
||||||
|
|
||||||
mocked_listdir.assert_called_with('/var/lib/mail/helpdesk/')
|
call_command('get_email')
|
||||||
mocked_isfile.assert_any_call('/var/lib/mail/helpdesk/filename1')
|
|
||||||
|
mocked_listdir.assert_called_with('/var/lib/mail/helpdesk/')
|
||||||
|
mocked_isfile.assert_any_call('/var/lib/mail/helpdesk/filename1')
|
||||||
|
|
||||||
# ensure these 4 CCs (test_email_cc one thru four) are the only ones
|
# ensure these 4 CCs (test_email_cc one thru four) are the only ones
|
||||||
# created and added to the existing staff_user that was CC'd,
|
# created and added to the existing staff_user that was CC'd,
|
||||||
@ -508,6 +509,5 @@ for method, socks in case_matrix:
|
|||||||
|
|
||||||
cl = type(test_name,
|
cl = type(test_name,
|
||||||
(GetEmailParametricTemplate,TestCase,),
|
(GetEmailParametricTemplate,TestCase,),
|
||||||
{ "method": method, "socks": socks}
|
{"method": method, "socks": socks})
|
||||||
)
|
|
||||||
setattr(thismodule, test_name, cl)
|
setattr(thismodule, test_name, cl)
|
||||||
|
Loading…
Reference in New Issue
Block a user