# Path: invtool/tests/utils.py
# def call_to_json(command_str):
#     """
#     Given a string, this function will shell out, execute the command
#     and parse the json returned by that command
#     """
#     print command_str
#     p = subprocess.Popen(shlex.split(command_str),
#                          stderr=subprocess.PIPE, stdout=subprocess.PIPE)
#     stdout, stderr = p.communicate()
#     if stderr:
#         return None, stderr, p.returncode
# 
#     stdout = stdout.replace('u\'', '"').replace('\'', '"').strip('\n')
#     try:
#         return json.loads(stdout, 'unicode'), None, p.returncode
#     except json.decoder.JSONDecodeError, e:
#         return (None,
#                 "Ret was: {0}. Got error: {1}".format(stdout, str(e)),
#                 p.returncode)
# 
# EXEC = "./inv --json"


import unittest
    import simplejson as json
    import json
from invtool.tests.utils import call_to_json, EXEC

                self.assertEqual(0, rc)

                self.assertTrue('http_status' in ret)
                self.assertEqual(ret['http_status'], expected_status)

            test_range()

            # CSV export
            def test_csv_export():
                expected_status, command = commands[2]
                ret, errors, rc = call_to_json(command)

                if errors:
                    self.fail(errors)

                self.assertEqual(0, rc)

                self.assertTrue('http_status' in ret)
                self.assertEqual(ret['http_status'], expected_status)

            test_csv_export()

        test_name = "test_{0}".format('search')
        place_holder.__name__ = test_name
        setattr(_TestCase, test_name, place_holder)
        return _TestCase

    def build_testcases():
        commands = []

# Path: invtool/tests/utils.py
# def call_to_json(command_str):
#     """
#     Given a string, this function will shell out, execute the command
#     and parse the json returned by that command
#     """
#     print command_str
#     p = subprocess.Popen(shlex.split(command_str),
#                          stderr=subprocess.PIPE, stdout=subprocess.PIPE)
#     stdout, stderr = p.communicate()
#     if stderr:
#         return None, stderr, p.returncode
# 
#     stdout = stdout.replace('u\'', '"').replace('\'', '"').strip('\n')
#     try:
#         return json.loads(stdout, 'unicode'), None, p.returncode
#     except json.decoder.JSONDecodeError, e:
#         return (None,
#                 "Ret was: {0}. Got error: {1}".format(stdout, str(e)),
#                 p.returncode)
# 
# EXEC = "./inv --json"


# Path: invtool/tests/search_tests.py
import unittest
    import simplejson as json
    import json
from invtool.tests.utils import call_to_json, EXEC


                self.assertEqual(0, rc)

                self.assertTrue('http_status' in ret)
                self.assertEqual(ret['http_status'], expected_status)

            test_range()

            # CSV export
            def test_csv_export():
                expected_status, command = commands[2]
                ret, errors, rc = call_to_json(command)

                if errors:
                    self.fail(errors)

                self.assertEqual(0, rc)

                self.assertTrue('http_status' in ret)
                self.assertEqual(ret['http_status'], expected_status)

            test_csv_export()

        test_name = "test_{0}".format('search')
        place_holder.__name__ = test_name
        setattr(_TestCase, test_name, place_holder)
        return _TestCase

    def build_testcases():
        commands = []

        command = [EXEC, 'search', ' -q "foopy32"']