def test_show_report_get(self): request = self.factory.get('/show_report/%s/' % self.scan.id) request.user = self.user request.yauser = self.user request.follow = True response = show_report(request, self.scan.id) self.assertEqual(response.status_code, 200)
def test_show_report_post(self, mock_import, mock_err_msg, mock_succ_msg): request = self.factory.post('/show_report/%s/' % self.scan.id, { 'vuln_id': self.vuln.id, }) request.user = self.user request.yauser = self.user mock_import.return_value = '' response = show_report(request, self.scan.id) self.assertEqual(response.status_code, 403) # CSRF! self.assertFalse(mock_err_msg.called) self.assertFalse(mock_succ_msg.called)
def test_show_report_post(self, mock_import, mock_err_msg, mock_succ_msg): request = self.factory.post( '/show_report/%s/' % self.scan.id, {'vuln_id': self.vuln.id,} ) request.user = self.user request.yauser = self.user mock_import.return_value = '' response = show_report(request, self.scan.id) self.assertEqual(response.status_code, 403) # CSRF! self.assertFalse(mock_err_msg.called) self.assertFalse(mock_succ_msg.called)