1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
use cratebatbelt;
use crateexecute_command;
use crateBatConfig;
use crate;
use crateBatDialoguer;
use crateGitCommit;
use crate;
use crateBatEnumerator;
use crate;
use Subcommand;
use Colorize;
use ;
use Command;
// use std::fs;
//
// use crate::batbelt::command_line::vs_code_open_file_in_current_window;
// use crate::{
// batbelt::{
// self,
// bash::execute_command,
// git::{create_git_commit, GitCommit},
// helpers::get::{
// get_only_files_from_folder, get_string_between_two_index_from_string,
// get_string_between_two_str_from_string,
// },
// path::{get_file_path, get_folder_path, FilePathType, FolderPathType},
// },
// config::BatConfig,
// };
//
// pub const FINDING_CODE_PREFIX: &str = "KS";
// pub const RESULT_FINDINGS_SECTION_HEADER: &str = "# Findings result";
// pub const RESULT_FINDINGS_TABLE_OF_FINDINGS_HEADER: &str = "## Table of findings";
// pub const RESULT_FINDINGS_LIST_OF_FINDINGS_HEADER: &str = "## List of Findings";
// pub const RESULT_FINDINGS_LIST_OF_FINDINGS_HEADER_ROBOT: &str = "# Findings";
// pub const RESULT_CODE_OVERHAUL_SECTION_HEADER: &str = "# Code overhaul result";
//
// pub const HTML_TABLE_STYLE: &str = "<style>
//
//
// tr th {
// background: #043456;
// color:white;
// width: 2%;
// text-align: center;
// border: 2px solid black;
// }
//
// .alg tr {
// width: 2%;
// text-align: center;
// border: 2px solid black;
// }
// .alg thead tr th:nth-of-type(2) {
// width: 9%;
// text-align: center;
// border: 2px solid black;
// }
//
// tr td {
// background: white;
// width: 2%;
// text-align: center;
// border: 2px solid black;
// }
// .high {
// background: #fd0011;
// border: 2px solid yellow;
// text-align: center;
// color: white;
// }
// .medium {
// background: #f58b45;
// border: 2px solid yellow;
// text-align: center;
// color: white;
// }
// .low {
// background: #16a54d;
// border: 20px solid yellow;
// text-align: center;
// color: white;
// }
// .informational {
// background: #0666b4;
// border: 2px solid yellow;
// text-align: center;
// color: white;
// }
// .open {
// background: #16a54d;
// border: 2px solid yellow;
// text-align: center;
// color: white;
// }
//
// .list th{
// background: #043456;
// color: white
// }
// .list td{
// color: black
// }
//
// </style>";
//
// pub const HTML_LIST_OF_FINDINGS_HEADER: &str = "<table class='list'>
// <thead>
// <tr>
// <th style='width:2%'>#</th> <th>Severity</th> <th style='width:10%'>Description</th> <th>Status</th>
// </tr>
// </thead>
// <tbody>
// RESULT_TABLE_PLACEHOLDER
// </tbody>
// </table>\n";
//
// pub const RESULT_TABLE_PLACEHOLDER: &str = "RESULT_TABLE_PLACEHOLDER";
//
// #[derive(PartialEq, Debug, Clone)]
// enum StatusLevel {
// Open,
// }
//
// impl StatusLevel {
// pub fn from_str(status_str: &str) -> Self {
// let severity = status_str.to_lowercase();
// let severity_binding = severity.as_str();
// match severity_binding {
// "open" => StatusLevel::Open,
// _ => panic!("incorrect status level {}", severity_binding),
// }
// }
// pub fn to_string(&self) -> String {
// match self {
// StatusLevel::Open => "Open".to_string(),
// }
// }
//
// pub fn get_hex_color(&self) -> String {
// match self {
// Self::Open => "#16a54d".to_string(),
// }
// }
// }
//
// #[derive(PartialEq, Debug, Clone)]
// enum FindingLevel {
// High,
// Medium,
// Low,
// Informational,
// }
//
// impl FindingLevel {
// pub fn from_str(severity_str: &str) -> Self {
// let severity = severity_str.to_lowercase();
// let severity_binding = severity.as_str();
// match severity_binding {
// "high" => FindingLevel::High,
// "medium" => FindingLevel::Medium,
// "low" => FindingLevel::Low,
// "informational" => FindingLevel::Informational,
// _ => panic!("incorrect severity level {}", severity_binding),
// }
// }
//
// pub fn to_string(&self) -> String {
// match self {
// FindingLevel::High => "High".to_string(),
// FindingLevel::Medium => "Medium".to_string(),
// FindingLevel::Low => "Low".to_string(),
// FindingLevel::Informational => "Informational".to_string(),
// }
// }
//
// pub fn get_hex_color(&self) -> String {
// match self {
// FindingLevel::High => "#fd0011".to_string(),
// FindingLevel::Medium => "#f58b45".to_string(),
// FindingLevel::Low => "#16a54d".to_string(),
// FindingLevel::Informational => "#0666b4".to_string(),
// }
// }
// }
//
// #[derive(PartialEq, Debug, Clone)]
// pub struct Finding {
// code: String,
// title: String,
// severity: FindingLevel,
// impact: Option<FindingLevel>,
// likelihood: Option<FindingLevel>,
// difficulty: Option<FindingLevel>,
// status: StatusLevel,
// content: String,
// index: usize,
// }
//
// impl Finding {
// pub fn new_from_path(finding_path: &str, index: usize) -> Self {
// let finding_content = fs::read_to_string(finding_path).unwrap();
// Self::new_from_str(&finding_content, index)
// }
//
// pub fn new_from_str(finding_content: &str, index: usize) -> Self {
// let content = Self::format_finding_content_header_with_finding_code(finding_content, index);
// let (code, title, severity_str, status, impact, likelihood, difficulty) =
// Self::parse_finding_data(&content);
// let severity = FindingLevel::from_str(&severity_str);
// Finding {
// code,
// title,
// severity,
// status,
// content,
// index,
// impact,
// likelihood,
// difficulty,
// }
// }
//
// pub fn format_markdown_to_html(&mut self) {
// let severity_index = self
// .content
// .lines()
// .position(|line| line.contains("**Severity:**"))
// .unwrap();
// let description_index = self
// .content
// .lines()
// .position(|line| line.contains("### Description"))
// .unwrap();
// let data_content = get_string_between_two_index_from_string(
// self.content.clone(),
// severity_index,
// description_index - 1,
// )
// .unwrap();
// let html_content = self.parse_finding_table_html();
// self.content = self.content.replace(&data_content, &html_content);
// }
//
// fn parse_finding_data(
// finding_content: &str,
// ) -> (
// String,
// String,
// String,
// StatusLevel,
// Option<FindingLevel>,
// Option<FindingLevel>,
// Option<FindingLevel>,
// ) {
// let finding_content_lines = finding_content.lines();
// let finding_content_first_line = finding_content_lines.clone().next().unwrap();
//
// let finding_code = finding_content_first_line
// .clone()
// .strip_prefix(&format!("## "))
// .unwrap()
// .split(" ")
// .next()
// .unwrap()
// .replace(":", "");
// let finding_description = finding_content_first_line
// .strip_prefix(&format!("## {finding_code}: "))
// .unwrap()
// .trim();
// let finding_severity = finding_content_lines
// .clone()
// .find(|line| line.contains("**Severity:**"))
// .unwrap()
// .strip_prefix("**Severity:** ")
// .unwrap();
//
// let finding_status = finding_content_lines
// .clone()
// .find(|line| line.contains("**Status:**"))
// .unwrap()
// .strip_prefix("**Status:** ")
// .unwrap();
// let finding_status = StatusLevel::from_str(finding_status);
// if FindingLevel::from_str(finding_severity) == FindingLevel::Informational {
// return (
// finding_code.to_string(),
// finding_description.to_string(),
// finding_severity.to_string(),
// finding_status,
// None,
// None,
// None,
// );
// }
// let finding_table = get_string_between_two_str_from_string(
// finding_content.to_string(),
// "**Status:**",
// "### Description",
// )
// .unwrap();
// let severities = ["High", "Medium", "Low"];
// let status = finding_table
// .lines()
// .find(|line| severities.iter().any(|severity| line.contains(severity)))
// .unwrap();
// let status_splited: Vec<&str> = status
// .split("|")
// .map(|spl| spl.trim())
// .filter(|spl| severities.iter().any(|severity| spl.contains(severity)))
// .collect();
// let impact = FindingLevel::from_str(&status_splited[0]);
// let likelihood = FindingLevel::from_str(&status_splited[1]);
// let difficulty = FindingLevel::from_str(&status_splited[2]);
// (
// finding_code.to_string(),
// finding_description.to_string(),
// finding_severity.to_string(),
// finding_status,
// Some(impact),
// Some(likelihood),
// Some(difficulty),
// )
// }
//
// pub fn format_finding_content_header_with_finding_code(
// finding_content: &str,
// index: usize,
// ) -> String {
// let mut finding_content_lines = finding_content.lines();
// let content_first_line = finding_content_lines.next().unwrap();
// let text_to_replace = format!(
// "## {}-{}:",
// FINDING_CODE_PREFIX,
// if index < 9 {
// format!("0{}", index + 1)
// } else {
// format!("{}", index + 1)
// }
// );
// let formatted_header = content_first_line.replace("##", &text_to_replace);
// let formatted_finding_content =
// finding_content.replace(content_first_line, &formatted_header);
// formatted_finding_content
// }
//
// pub fn parse_table_of_findings_table_row(&self) -> String {
// format!(
// "|{}|{:#?}|{}|{:#?}|",
// self.code, self.severity, self.title, self.status
// )
// }
//
// pub fn parse_list_of_findings_table_row_html(&self) -> String {
// // <th>#</th> <th>Severity</th> <th>Description</th> <th>Status</th>
// let severity = format!(
// "<span style='color:{};'>{:#?}</span>",
// self.severity.get_hex_color(),
// self.severity
// );
// let status = format!(
// "<span style='color:{};'>{:#?}</span>",
// self.status.get_hex_color(),
// self.status
// );
// format!(
// "<tr><td>{}</td> <td>{}</td> <td>{}</td> <td>{}</td></tr>",
// self.code, severity, self.title, status
// )
// }
//
// pub fn parse_finding_content_for_audit_folder_path(&self) -> String {
// self.content.replace("../../figures", "./figures")
// }
//
// pub fn parse_finding_content_for_root_path(&self) -> String {
// let audit_result_figures_path = get_folder_path(FolderPathType::AuditResultFigures, false);
// self.content
// .replace("../../figures", &audit_result_figures_path)
// }
//
// pub fn parse_finding_table_html(&self) -> String {
// let Finding {
// severity,
// impact,
// likelihood,
// difficulty,
// status,
// ..
// } = self;
// if severity.clone() == FindingLevel::Informational {
// format!("<div style='width:50%; margin: auto'>
// <table class='alg'>
// <thead>
// <tr>
// <th style='font-weight:bold'>Severity</th> <th class='informational'>Informational</th>
// </thead>
// </tr>
// <tbody>
// <tr>
// <td style='background: #043456; color: white; font-weight:bold'>Status</td> <td class='{}'>{}</td>
// </tr>
// </tbody>
// </table>
// </div>\n",status.to_string().to_lowercase(), status.to_string()
// )
// } else {
// let difficulty_style = match difficulty.clone().unwrap() {
// FindingLevel::Low => "high",
// FindingLevel::Medium => "medium",
// FindingLevel::High => "low",
// _ => unimplemented!(),
// };
//
// format!(
// "
// <div style='width:50%; margin: auto'>
// <table class='alg'>
// <thead>
// <tr>
// <th style='font-weight:bold'>Severity</th> <th class='{}'>{}</th>
// </thead>
// </tr>
// <tbody>
// <tr>
// <td style='background: #043456; color: white; font-weight:bold'>Status</td> <td class='{}'>{}</td>
// </tr>
// </tbody>
// </table>
// </div>
// <table>
// <thead>
// <tr>
// <th>Impact</th> <th>Likelihood</th> <th>Difficulty</th>
// </tr>
// </thead>
// <tbody>
// <tr>
// <td class='{}'>{}</td> <td class='{}'>{}</td> <td class='{}'>{}</td>
// </tr>
// </tbody>
// </table>\n",
// severity.to_string().to_lowercase(),
// severity.to_string(),
// status.to_string().to_lowercase(),
// status.to_string(),
// impact.clone().unwrap().to_string().to_lowercase(),
// impact.clone().unwrap().to_string(),
// likelihood.clone().unwrap().to_string().to_lowercase(),
// likelihood.clone().unwrap().to_string(),
// difficulty_style,
// difficulty.clone().unwrap().to_string(),
// )
// }
// }
// }
// pub fn findings_result(generate_html: bool) -> Result<(), String> {
// // get the audit_result path
// let audit_result_temp_path =
// batbelt::path::get_folder_path(FolderPathType::AuditResultTemp, false);
// let audit_result_figures_path =
// batbelt::path::get_folder_path(FolderPathType::AuditResultFigures, true);
// let notes_folder = batbelt::path::get_folder_path(FolderPathType::Notes, true);
//
// // create a temp folder for the findings
// batbelt::bash::execute_command("mkdir", &[&audit_result_temp_path]).unwrap();
// // delete figures folder
// batbelt::bash::execute_command("rm", &["-rf", &audit_result_figures_path]).unwrap();
// // create figures folder
// batbelt::bash::execute_command("mkdir", &[&audit_result_figures_path]).unwrap();
//
// // copy all the data to the audit_result folder
// let auditor_names = BatConfig::get_validated_config()?.required.auditor_names;
// for auditor in auditor_names {
// let auditor_notes_path = format!("{}/{}-notes", notes_folder, auditor);
// let auditor_accepted_findings_path = format!("{}/findings/accepted", auditor_notes_path);
//
// let findings_files = get_only_files_from_folder(auditor_accepted_findings_path)?;
// // for each auditor, copy all the findings to the temp folder
// for finding_file in findings_files {
// batbelt::bash::execute_command("cp", &[&finding_file.path, &audit_result_temp_path])
// .unwrap();
// }
//
// // for each auditor, copy all the figures to the audit_result figures folder
// let auditor_figures_path = format!("{}/figures", auditor_notes_path);
// let figures_files = get_only_files_from_folder(auditor_figures_path)?;
// for figure_file in figures_files {
// batbelt::bash::execute_command("cp", &[&figure_file.path, &audit_result_figures_path])
// .unwrap();
// }
// }
// let findings_result_file_path =
// get_file_path(batbelt::path::FilePathType::FindingsResult, true);
// // remove previous findings_result.md file
// execute_command("rm", &[&findings_result_file_path]).unwrap();
// // create new findings_result.md file
// execute_command("touch", &[&findings_result_file_path]).unwrap();
// // create new findings_result.md file
// let findings_temp_files = get_only_files_from_folder(audit_result_temp_path.clone())?;
// let mut table_of_findings: String = if generate_html {
// format!("{RESULT_FINDINGS_SECTION_HEADER}\n\n{RESULT_FINDINGS_TABLE_OF_FINDINGS_HEADER}\n{HTML_LIST_OF_FINDINGS_HEADER}\n")
// } else {
// format!("{RESULT_FINDINGS_SECTION_HEADER}\n\n{RESULT_FINDINGS_TABLE_OF_FINDINGS_HEADER}\n|#|Severity|Description|Status|\n| :---: | :------: | :----------: | :------------: |")
// };
// let mut subfolder_findings_content: String =
// format!("\n{RESULT_FINDINGS_LIST_OF_FINDINGS_HEADER}\n\n");
// let mut robot_content: String = format!("{RESULT_FINDINGS_LIST_OF_FINDINGS_HEADER_ROBOT}\n");
// let mut root_findings_content: String =
// format!("\n{RESULT_FINDINGS_LIST_OF_FINDINGS_HEADER}\n\n");
// let mut html_rows: Vec<String> = vec![];
// for (finding_file_index, finding_file) in findings_temp_files.into_iter().enumerate() {
// // for every finding file, replace the figures path
// let mut finding = Finding::new_from_path(&finding_file.path, finding_file_index);
// if generate_html {
// finding.format_markdown_to_html();
// }
// html_rows.push(finding.parse_list_of_findings_table_row_html());
//
// subfolder_findings_content = format!(
// "{}\n{}\n---\n",
// subfolder_findings_content,
// finding
// .clone()
// .parse_finding_content_for_audit_folder_path()
// );
// robot_content = format!(
// "{}\n{}\n---\n",
// robot_content,
// finding
// .clone()
// .parse_finding_content_for_audit_folder_path()
// );
// root_findings_content = format!(
// "{}\n{}\n---\n",
// root_findings_content,
// finding.parse_finding_content_for_root_path()
// );
// if !generate_html {
// let table_of_contents_row = finding.parse_table_of_findings_table_row();
// table_of_findings = format!("{}\n{}", table_of_findings, table_of_contents_row);
// }
// }
// if generate_html {
// table_of_findings =
// table_of_findings.replace(RESULT_TABLE_PLACEHOLDER, &html_rows.join("\n"))
// }
// // get content for root and sub folder
// let root_content = if generate_html {
// format!(
// "{}\n{}\n\n\n\n{HTML_TABLE_STYLE}",
// table_of_findings, root_findings_content
// )
// } else {
// format!("{}\n{}", table_of_findings, root_findings_content)
// };
// let audit_folder_content = if generate_html {
// format!(
// "{}\n{}\n\n\n\n{HTML_TABLE_STYLE}",
// table_of_findings, subfolder_findings_content
// )
// } else {
// format!("{}\n{}", table_of_findings, subfolder_findings_content)
// };
//
// let robot_findings_path = get_file_path(FilePathType::FindingsRobotResult, false);
// fs::write(&robot_findings_path, robot_content).unwrap();
//
// // write to root
// helpers::update_audit_result_root_content(&root_content)?;
// // write to audit_result folder
// fs::write(&findings_result_file_path, audit_folder_content).unwrap();
// // remove temp folder
// execute_command("rm", &["-rf", &audit_result_temp_path]).unwrap();
// let audit_result_file_path = get_file_path(FilePathType::AuditResult, true);
// vs_code_open_file_in_current_window(&findings_result_file_path)?;
// vs_code_open_file_in_current_window(&audit_result_file_path)?;
//
// let prompt_text = "Do you want to create the commit already?";
// let user_decided_to_create_commit = batbelt::cli_inputs::select_yes_or_no(prompt_text)?;
// if user_decided_to_create_commit {
// create_git_commit(GitCommit::AuditResult, None)?;
// }
// Ok(())
// }
//
// pub fn results_commit() -> Result<(), String> {
// create_git_commit(GitCommit::AuditResult, None)?;
// Ok(())
// }
//
// mod helpers {
// use crate::batbelt::helpers::get::get_string_between_two_str_from_path;
//
// use super::*;
//
// pub fn update_audit_result_root_content(root_content: &str) -> Result<(), String> {
// let audit_result_file_path = get_file_path(FilePathType::AuditResult, true);
// let audit_result_content = fs::read_to_string(&audit_result_file_path).unwrap();
// let findings_result_content = get_string_between_two_str_from_path(
// audit_result_file_path.clone(),
// RESULT_FINDINGS_SECTION_HEADER,
// RESULT_CODE_OVERHAUL_SECTION_HEADER,
// )?;
// let updated_content = audit_result_content.replace(&findings_result_content, root_content);
// fs::write(audit_result_file_path, updated_content).unwrap();
// Ok(())
// }
// }
//
// #[test]
//
// fn test_format_header_with_finding_code_with_index_smaller_than_9() {
// let finding_content = "## Super bad finding \n rest of description";
// let finding_index = 2;
// let expected_content = "## KS-03 Super bad finding \n rest of description";
// let finding = Finding::new_from_str(finding_content, finding_index);
// assert_eq!(expected_content.to_string(), finding.content);
// }
//
// #[test]
// fn test_format_header_with_finding_code_with_index_bigger_than_9() {
// let finding_content = "## Super bad finding \n rest of description";
// let finding_index = 10;
// let expected_content = "## KS-11 Super bad finding \n rest of description";
// let finding = Finding::new_from_str(finding_content, finding_index);
// assert_eq!(expected_content.to_string(), finding.content);
// }
//
// #[test]
// fn test_parse_finding_data() {
// let finding_content = "## This is the description \n\n**Severity:** High\n\n**Status:** Open\n\n| Impact | Likelihood | Difficulty |\n| :----: | :--------: | :--------: |\n| High | Medium | Low |\n\n### Description {-}\n\n";
// let finding = Finding::new_from_str(finding_content, 0);
// assert_eq!(
// (
// finding.code,
// finding.title,
// finding.severity,
// finding.status,
// finding.impact.clone().unwrap(),
// finding.likelihood.clone().unwrap(),
// finding.difficulty.clone().unwrap(),
// ),
// (
// "KS-01".to_string(),
// "This is the description".to_string(),
// FindingLevel::High,
// StatusLevel::Open,
// FindingLevel::High,
// FindingLevel::Medium,
// FindingLevel::Low,
// )
// );
// }
//
// #[test]
// fn test_parse_finding_table_row() {
// let finding_content =
// "## KS-01 This is the description \n\n**Severity:** High\n\n**Status:** Open";
// let finding = Finding::new_from_str(finding_content, 0);
// let finding_table_row = finding.parse_table_of_findings_table_row();
// assert_eq!(
// finding_table_row,
// "|KS-01|High|This is the description|Open|"
// );
// }
//
// #[test]
// fn test_get_html_content() {
// let finding_content = "## This is the description \n\n**Severity:** High\n\n**Status:** Open\n\n| Impact | Likelihood | Difficulty |\n| :----: | :--------: | :--------: |\n| High | Medium | Low |\n\n### Description {-}\n\n";
// let finding = Finding::new_from_str(finding_content, 0);
// let finding_table_row = finding.parse_finding_table_html();
// println!("table {:#?}", finding_table_row);
// }
//
// #[test]
// fn test_update_content() {
// let finding_content = "## This is the description \n\n**Severity:** High\n\n**Status:** Open\n\n| Impact | Likelihood | Difficulty |\n| :----: | :--------: | :--------: |\n| High | Medium | Low |\n\n### Description {-}\n\n";
// let mut finding = Finding::new_from_str(finding_content, 0);
// finding.format_markdown_to_html();
// println!("table {}", finding.content);
// // assert_eq!(
// // finding_table_row,
// // "|KS-01|High|This is the description|Open|"
// // );
// }