Skip to content

Commit

Permalink
remove lxml dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Feb 19, 2018
1 parent ec09dae commit cc7bca7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
30 changes: 17 additions & 13 deletions daiquiri/jobs/tests/mixins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import iso8601

from lxml import objectify
import xml.etree.ElementTree as et

from django.core.urlresolvers import reverse
from django.db.models import Q
Expand Down Expand Up @@ -68,10 +68,14 @@ def _test_get_job_list_xml(self, username):
self.assertEqual(response.status_code, 200)

if username == 'user':
root = objectify.fromstring(response.content)
root = et.fromstring(response.content)
children = root.getchildren()

self.assertEqual(root.tag, self.uws_ns + 'jobs')
self.assertEqual(root.jobref.tag, self.uws_ns + 'jobref')
self.assertEqual(len(root.jobref), len(self.jobs))
self.assertEqual(len(children), len(self.jobs))

for node in children:
self.assertEqual(node.tag, self.uws_ns + 'jobref')

def _test_get_job_list_xml_phase(self, username):
'''
Expand All @@ -83,8 +87,8 @@ def _test_get_job_list_xml_phase(self, username):
self.assertEqual(response.status_code, 200)

if username == 'user':
root = objectify.fromstring(response.content)
self.assertEqual(len(root.jobref), len(self.jobs.filter(Q(phase='PENDING')|Q(phase='ARCHIVED'))))
root = et.fromstring(response.content)
self.assertEqual(len(root.getchildren()), len(self.jobs.filter(Q(phase='PENDING')|Q(phase='ARCHIVED'))))

def _test_get_job_list_xml_after(self, username):
'''
Expand All @@ -97,8 +101,8 @@ def _test_get_job_list_xml_after(self, username):
self.assertEqual(response.status_code, 200)

if username == 'user':
root = objectify.fromstring(response.content)
self.assertEqual(len(root.jobref), len(self.jobs.filter(creation_time__gte='2017-01-01T01:00:00Z')))
root = et.fromstring(response.content)
self.assertEqual(len(root.getchildren()), len(self.jobs.filter(creation_time__gte='2017-01-01T01:00:00Z')))

def _test_get_job_list_xml_last(self, username):
'''
Expand All @@ -110,8 +114,8 @@ def _test_get_job_list_xml_last(self, username):
self.assertEqual(response.status_code, 200)

if username == 'user':
root = objectify.fromstring(response.content)
self.assertEqual(len(root.jobref), 3)
root = et.fromstring(response.content)
self.assertEqual(len(root.getchildren()), 3)

def _test_post_job_list_create(self, username):
'''
Expand Down Expand Up @@ -179,7 +183,7 @@ def _test_get_job_detail(self, username):
if username == 'user':
self.assertEqual(response.status_code, 200)

root = objectify.fromstring(response.content)
root = et.fromstring(response.content)
self.assertEqual(root.tag, self.uws_ns + 'job')
else:
self.assertEqual(response.status_code, 404)
Expand All @@ -196,7 +200,7 @@ def _test_get_job_results(self, username):
if username == 'user':
self.assertEqual(response.status_code, 200)

root = objectify.fromstring(response.content)
root = et.fromstring(response.content)
self.assertEqual(root.tag, self.uws_ns + 'results')
else:
self.assertEqual(response.status_code, 404)
Expand Down Expand Up @@ -231,7 +235,7 @@ def _test_get_job_parameters(self, username):
if username == 'user':
self.assertEqual(response.status_code, 200)

root = objectify.fromstring(response.content)
root = et.fromstring(response.content)
self.assertEqual(root.tag, self.uws_ns + 'parameters')
else:
self.assertEqual(response.status_code, 404)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
'jsonfield==1.0.0',
'Markdown>=2.6.8',
'iso8601>=0.1.11',
'lxml>=3.7.3',
'bitstring>=3.1.5',
'ipaddress>=1.0.18',
'django-test-generator>=0.3.3',
Expand Down

0 comments on commit cc7bca7

Please sign in to comment.