# -*- coding: utf-8 -*-
from hashlib import md5
from armet.utils import test


class ResponseTestCase(test.TestCase):

    def setUp(self):
        super(ResponseTestCase, self).setUp()
        self.endpoint = '/'

    def test_content_md5(self):
        # Check some random endpoint
        endpoint = '{}choice/1'.format(self.endpoint)
        response = self.client.get(endpoint)
        # Assert we got a Content-MD5 header
        self.assertTrue(response.has_header('Content-MD5'))
        # Make an MD5 of the body.
        md5_body = md5(response.content).hexdigest()
        # Assert the MD5 is correct.
        self.assertEqual(response['Content-MD5'], md5_body)

Test case for Content-MD5 response.
Test case for Content-MD5 response.
