mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-12 12:46:53 +02:00
Fix PEP8 errors
This commit is contained in:
parent
f6c323c9ab
commit
a0fb315c3b
@ -39,7 +39,7 @@ def num_to_link(text):
|
|||||||
if ticket:
|
if ticket:
|
||||||
style = ticket.get_status_display()
|
style = ticket.get_status_display()
|
||||||
text = "%s <a href='%s' class='ticket_link_status ticket_link_status_%s'>#%s</a>%s" % (
|
text = "%s <a href='%s' class='ticket_link_status ticket_link_status_%s'>#%s</a>%s" % (
|
||||||
text[:match.start()+1], url, style, match.groups()[0], text[match.end():])
|
text[:match.start() + 1], url, style, match.groups()[0], text[match.end():])
|
||||||
return mark_safe(text)
|
return mark_safe(text)
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
@ -12,6 +12,7 @@ except ImportError: # python 2
|
|||||||
|
|
||||||
from helpdesk.templatetags.ticket_to_link import num_to_link
|
from helpdesk.templatetags.ticket_to_link import num_to_link
|
||||||
|
|
||||||
|
|
||||||
class TicketActionsTestCase(TestCase):
|
class TicketActionsTestCase(TestCase):
|
||||||
fixtures = ['emailtemplate.json']
|
fixtures = ['emailtemplate.json']
|
||||||
|
|
||||||
@ -122,13 +123,13 @@ class TicketActionsTestCase(TestCase):
|
|||||||
}
|
}
|
||||||
response = self.client.post(reverse('helpdesk:update', kwargs={'ticket_id': ticket_id}), post_data, follow=True)
|
response = self.client.post(reverse('helpdesk:update', kwargs={'ticket_id': ticket_id}), post_data, follow=True)
|
||||||
self.assertContains(response, 'Changed Status from Open to Closed')
|
self.assertContains(response, 'Changed Status from Open to Closed')
|
||||||
|
|
||||||
def test_num_to_link(self):
|
def test_num_to_link(self):
|
||||||
"""Test that we are correctly expanding links to tickets from IDs"""
|
"""Test that we are correctly expanding links to tickets from IDs"""
|
||||||
|
|
||||||
# make staff user
|
# make staff user
|
||||||
self.loginUser()
|
self.loginUser()
|
||||||
|
|
||||||
initial_data = {
|
initial_data = {
|
||||||
'title': 'Some private ticket',
|
'title': 'Some private ticket',
|
||||||
'queue': self.queue_public,
|
'queue': self.queue_public,
|
||||||
@ -139,11 +140,11 @@ class TicketActionsTestCase(TestCase):
|
|||||||
# create ticket
|
# create ticket
|
||||||
ticket = Ticket.objects.create(**initial_data)
|
ticket = Ticket.objects.create(**initial_data)
|
||||||
ticket_id = ticket.id
|
ticket_id = ticket.id
|
||||||
|
|
||||||
# generate the URL text
|
# generate the URL text
|
||||||
result = num_to_link('this is ticket#%s' % ticket_id)
|
result = num_to_link('this is ticket#%s' % ticket_id)
|
||||||
self.assertEqual(result, "this is ticket <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a>" % (ticket_id, ticket_id))
|
self.assertEqual(result, "this is ticket <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a>" % (ticket_id, ticket_id))
|
||||||
|
|
||||||
result2 = num_to_link('whoa another ticket is here #%s huh' % ticket_id)
|
result2 = num_to_link('whoa another ticket is here #%s huh' % ticket_id)
|
||||||
self.assertEqual(result2, "whoa another ticket is here <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a> huh" % (ticket_id, ticket_id))
|
self.assertEqual(result2, "whoa another ticket is here <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a> huh" % (ticket_id, ticket_id))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user