From 1a7cf2ec0e1b67e465311dc60cd0d8bd12dd68c5 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Mon, 13 Nov 2017 23:42:53 +0530 Subject: [PATCH] fix the tests and cleanup dependencies --- requirements.txt | 12 +++++------- setup.py | 2 +- tests/test.py | 10 ++++++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/requirements.txt b/requirements.txt index e017d2d..b811cc8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,5 @@ -Beautifulsoup4==4.4.1 -dict2xml==1.3 -json2xml==1.0.1 -requests==2.9.1 -simplejson==3.6.5 -six==1.9.0 -wheel==0.24.0 +dict2xml==1.5 +six==1.11.0 +lxml==4.1.1 +requests==2.18.4 +xmltodict==0.11.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 080a27e..138438f 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,9 @@ include_package_data=True, install_requires=[ 'dict2xml==1.5', - 'simplejson==3.10.0', 'six==1.11.0', 'lxml==4.1.1', 'requests==2.18.4', + 'xmltodict==0.11.0' ], ) diff --git a/tests/test.py b/tests/test.py index d337c5c..d285e54 100644 --- a/tests/test.py +++ b/tests/test.py @@ -7,6 +7,10 @@ import unittest +from collections import OrderedDict + +import xmltodict + from src.json2xml import Json2xml @@ -15,8 +19,10 @@ def test_is_json_from_file_works(self): data = Json2xml.fromjsonfile('examples/example.json').data data_object = Json2xml(data) xml_output = data_object.json2xml() - htmlkeys = xml_output.XML_FORMATTERS.keys() - self.assertTrue('html' in htmlkeys) + dict_from_xml = xmltodict.parse(xml_output) + # since it's a valid XML, xml to dict is able to load it and return + # elements from under the all tag of xml + self.assertTrue(type(dict_from_xml['all']) == OrderedDict) if __name__ == '__main__':