'Test case in which 4 policies are specified using 4 differents CSP
headers and in which 1 is specified using report only CSP header.
Test in which we want only mandatory policies.'

def test_retrieve_csp_policies_with_policies_case04(self):

    hrds = {}
    hrds[CSP_HEADER_W3C] = (CSP_DIRECTIVE_OBJECT + "    'none'")
    hrds[CSP_HEADER_FIREFOX] = (CSP_DIRECTIVE_IMAGE + '    *')
    hrds[CSP_HEADER_CHROME] = (CSP_DIRECTIVE_CONNECTION + '    trust.sample.com')
    hrds[CSP_HEADER_W3C_REPORT_ONLY] = (CSP_DIRECTIVE_SCRIPT + '    report.sample.com')
    csp_headers = Headers(hrds.items())
    http_response = HTTPResponse(200, '', csp_headers, self.url, self.url)
    policies = retrieve_csp_policies(http_response)
    self.assertEqual(len(policies), 3)
    self.assertEqual(len(policies[CSP_DIRECTIVE_OBJECT]), 1)
    self.assertEqual(policies[CSP_DIRECTIVE_OBJECT][0], 'none')
    self.assertEqual(len(policies[CSP_DIRECTIVE_IMAGE]), 1)
    self.assertEqual(policies[CSP_DIRECTIVE_IMAGE][0], '*')
    self.assertEqual(len(policies[CSP_DIRECTIVE_CONNECTION]), 1)
    self.assertEqual(policies[CSP_DIRECTIVE_CONNECTION][0], 'trust.sample.com')
