pycodestyle fixes

This commit is contained in:
Timothy Hobbs 2020-02-11 16:47:33 +01:00
parent bb9d886eea
commit 3d7860b5a3
3 changed files with 20 additions and 18 deletions

View File

@ -85,7 +85,7 @@ DATATABLES_ORDER_COLUMN_CHOICES = Choices(
('6', 'due_date'), ('6', 'due_date'),
('7', 'assigned_to'), ('7', 'assigned_to'),
('8', 'submitter_email'), ('8', 'submitter_email'),
#('9', 'time_spent'), # ('9', 'time_spent'),
('10', 'kbitem'), ('10', 'kbitem'),
) )

View File

@ -66,4 +66,3 @@ class DatatablesTicketSerializer(serializers.ModelSerializer):
def get_kbitem(self, obj): def get_kbitem(self, obj):
return obj.kbitem.title if obj.kbitem else "" return obj.kbitem.title if obj.kbitem else ""

View File

@ -61,12 +61,13 @@ class QueryTests(TestCase):
response = self.client.get(reverse('helpdesk:datatables_ticket_list', args=[query])) response = self.client.get(reverse('helpdesk:datatables_ticket_list', args=[query]))
self.assertEqual( self.assertEqual(
response.json(), response.json(),
{"data": {
[{"ticket": "1 [test_queue-1]", "id": 1, "priority": 3, "title": "unassigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": ""}, "data":
{"ticket": "2 [test_queue-2]", "id": 2, "priority": 3, "title": "assigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": "KBItem 1"}], [{"ticket": "1 [test_queue-1]", "id": 1, "priority": 3, "title": "unassigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": ""},
"recordsFiltered": 2, {"ticket": "2 [test_queue-2]", "id": 2, "priority": 3, "title": "assigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": "KBItem 1"}],
"recordsTotal": 2, "recordsFiltered": 2,
"draw": 0, "recordsTotal": 2,
"draw": 0,
}, },
) )
@ -78,11 +79,12 @@ class QueryTests(TestCase):
response = self.client.get(reverse('helpdesk:datatables_ticket_list', args=[query])) response = self.client.get(reverse('helpdesk:datatables_ticket_list', args=[query]))
self.assertEqual( self.assertEqual(
response.json(), response.json(),
{"data": {
[{"ticket": "2 [test_queue-2]", "id": 2, "priority": 3, "title": "assigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": "KBItem 1"}], "data":
"recordsFiltered": 1, [{"ticket": "2 [test_queue-2]", "id": 2, "priority": 3, "title": "assigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": "KBItem 1"}],
"recordsTotal": 1, "recordsFiltered": 1,
"draw": 0, "recordsTotal": 1,
"draw": 0,
}, },
) )
@ -94,10 +96,11 @@ class QueryTests(TestCase):
response = self.client.get(reverse('helpdesk:datatables_ticket_list', args=[query])) response = self.client.get(reverse('helpdesk:datatables_ticket_list', args=[query]))
self.assertEqual( self.assertEqual(
response.json(), response.json(),
{"data": {
[{"ticket": "2 [test_queue-2]", "id": 2, "priority": 3, "title": "assigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": "KBItem 1"}], "data":
"recordsFiltered": 1, [{"ticket": "2 [test_queue-2]", "id": 2, "priority": 3, "title": "assigned to kbitem", "queue": {"title": "Test queue", "id": 1}, "status": "Open", "created": "now", "due_date": None, "assigned_to": "None", "submitter": None, "row_class": "", "time_spent": "", "kbitem": "KBItem 1"}],
"recordsTotal": 1, "recordsFiltered": 1,
"draw": 0, "recordsTotal": 1,
"draw": 0,
}, },
) )