# Path: tests/_utils.py
# class HatbandTestCase(ArmstrongTestCase):
#     pass
# 
# Path: armstrong/hatband/http.py
# class JsonResponse(HttpResponse):
#     """
#     Simple HttpResponse object that takes a JSON value as it's parameter
# 
#     TODO: Find a proper home for this.
#     """
#     def __init__(self, data, *args, **kwargs):
#         super(JsonResponse, self).__init__(json.dumps(data), *args, **kwargs)


import json
import random
from ._utils import HatbandTestCase
from armstrong.hatband.http import JsonResponse




class JsonResponseTestCase(HatbandTestCase):
    def test_turns_body_into_json(self):
        data = {
            "foo": "bar",
            "random": random.randint(1000, 2000),
        }

        response = JsonResponse(data)
        self.assertIsInstance(response.content, basestring)

# Path: tests/_utils.py
# class HatbandTestCase(ArmstrongTestCase):
#     pass
# 
# Path: armstrong/hatband/http.py
# class JsonResponse(HttpResponse):
#     """
#     Simple HttpResponse object that takes a JSON value as it's parameter
# 
#     TODO: Find a proper home for this.
#     """
#     def __init__(self, data, *args, **kwargs):
#         super(JsonResponse, self).__init__(json.dumps(data), *args, **kwargs)


# Path: tests/http.py
import json
import random
from ._utils import HatbandTestCase
from armstrong.hatband.http import JsonResponse





class JsonResponseTestCase(HatbandTestCase):
    def test_turns_body_into_json(self):
        data = {
            "foo": "bar",
            "random": random.randint(1000, 2000),
        }

        response = JsonResponse(data)
        self.assertIsInstance(response.content, basestring)

        self.assertEqual(json.loads(response.content), data)