# Path: oaxmlapi/utilities.py
# ADDRESS_FIELDS = ('first', 'middle', 'last', 'salutation', 'email', 'phone',
#     'fax', 'mobile', 'addr1', 'addr2', 'addr3', 'addr4', 'city', 'state',
#     'zip', 'country', )
# READ_METHODS = ('all', 'equal to', 'not equal to', 'custom equal to', 'user',
#     'project', 'not exported', )
# READ_ATTRIBUTES = ('limit', 'deleted', 'include_flags', '_include_nondeleted',
#     '_with_project_only', 'base_currency', 'generic', 'enable_custom', )
# REPORT_TYPES = ('Envelope', 'Timesheet', 'Report', )
# SUBMIT_TYPES = ('Envelope', 'Timesheet', 'Invoice', )
# SWITCH_TYPES = ('Company', 'User', )
# PAGE_ATTRIBUTES = ('default-url', 'company-settings', 'currency-rates',
#     'import-export', 'custom-fields', 'list-reports', 'list-customers',
#     'list-projects', 'list-prospects', 'list-resources', 'list-timesheets',
#     'create-timesheet', 'list-timebills', 'list-invoices', 'create-invoice',
#     'list-envelope-receipts', 'list-envelopes', 'create-envelope',
#     'create-envelope-receipt', 'dashboard', 'list-purchase-requests',
#     'quick-search-resources', 'custom-search-resources', 'view-invoice',
#     'dashboard-project', 'grid-timesheet', 'report-timesheet', )
# APP_ATTRIBUTES = ('km', 'ma', 'pb', 'rm', 'pm', 'ta', 'te', 'tb', )
# def elem2dict(elem, strip=True):
# def xml2json(xmlstring, strip=True):


import unittest
    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from oaxmlapi import utilities
# -*- coding: utf-8
from __future__ import absolute_import, print_function

try:
except ImportError:


class TestUtilitiesClass(unittest.TestCase):

    def test_json_str_true(self):
        xml_res = (
            '<response><Auth status="0"/><Read status="0">'
            '<Invoice><total> 99.00 </total></Invoice></Read></response>'
        )
        self.assertEqual(
            utilities.xml2json(xml_res, strip=True),
            (
            '{"response": {"Auth": {"@status": "0"}, "Read": {'
            '"@status": "0", "Invoice": {"total": "99.00"}}}}'
            )
        )

    def test_json_str_false(self):
        xml_res = (
            '<response><Auth status="0"/><Read status="0">'
            '<Invoice><total> 99.00 </total></Invoice></Read></response>'
        )
        self.assertEqual(

# Path: oaxmlapi/utilities.py
# ADDRESS_FIELDS = ('first', 'middle', 'last', 'salutation', 'email', 'phone',
#     'fax', 'mobile', 'addr1', 'addr2', 'addr3', 'addr4', 'city', 'state',
#     'zip', 'country', )
# READ_METHODS = ('all', 'equal to', 'not equal to', 'custom equal to', 'user',
#     'project', 'not exported', )
# READ_ATTRIBUTES = ('limit', 'deleted', 'include_flags', '_include_nondeleted',
#     '_with_project_only', 'base_currency', 'generic', 'enable_custom', )
# REPORT_TYPES = ('Envelope', 'Timesheet', 'Report', )
# SUBMIT_TYPES = ('Envelope', 'Timesheet', 'Invoice', )
# SWITCH_TYPES = ('Company', 'User', )
# PAGE_ATTRIBUTES = ('default-url', 'company-settings', 'currency-rates',
#     'import-export', 'custom-fields', 'list-reports', 'list-customers',
#     'list-projects', 'list-prospects', 'list-resources', 'list-timesheets',
#     'create-timesheet', 'list-timebills', 'list-invoices', 'create-invoice',
#     'list-envelope-receipts', 'list-envelopes', 'create-envelope',
#     'create-envelope-receipt', 'dashboard', 'list-purchase-requests',
#     'quick-search-resources', 'custom-search-resources', 'view-invoice',
#     'dashboard-project', 'grid-timesheet', 'report-timesheet', )
# APP_ATTRIBUTES = ('km', 'ma', 'pb', 'rm', 'pm', 'ta', 'te', 'tb', )
# def elem2dict(elem, strip=True):
# def xml2json(xmlstring, strip=True):


# Path: tests/utilities/test_utilities.py
import unittest
    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from oaxmlapi import utilities

# -*- coding: utf-8
from __future__ import absolute_import, print_function

try:
except ImportError:


class TestUtilitiesClass(unittest.TestCase):

    def test_json_str_true(self):
        xml_res = (
            '<response><Auth status="0"/><Read status="0">'
            '<Invoice><total> 99.00 </total></Invoice></Read></response>'
        )
        self.assertEqual(
            utilities.xml2json(xml_res, strip=True),
            (
            '{"response": {"Auth": {"@status": "0"}, "Read": {'
            '"@status": "0", "Invoice": {"total": "99.00"}}}}'
            )
        )

    def test_json_str_false(self):
        xml_res = (
            '<response><Auth status="0"/><Read status="0">'
            '<Invoice><total> 99.00 </total></Invoice></Read></response>'
        )
        self.assertEqual(

            utilities.xml2json(xml_res, strip=False),