mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-27 10:03:56 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			747 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			747 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from zerver.lib.test_classes import ZulipTestCase
 | |
| 
 | |
| 
 | |
| class TestReport(ZulipTestCase):
 | |
|     def test_report_csp_violations(self) -> None:
 | |
|         fixture_data = self.fixture_data("csp_report.json")
 | |
|         with self.assertLogs(level="WARNING") as warn_logs:
 | |
|             result = self.client_post(
 | |
|                 "/report/csp_violations", fixture_data, content_type="application/json"
 | |
|             )
 | |
|         self.assert_json_success(result)
 | |
|         self.assertEqual(
 | |
|             warn_logs.output,
 | |
|             [
 | |
|                 "WARNING:root:CSP violation in document(''). blocked URI(''), original policy(''), violated directive(''), effective directive(''), disposition(''), referrer(''), status code(''), script sample('')"
 | |
|             ],
 | |
|         )
 |