Skip to content

Commit 6ec6c09

Browse files
committed
Migrate from left_untouched to untouched
1 parent 10c280f commit 6ec6c09

6 files changed

Lines changed: 13 additions & 18 deletions

File tree

docs/content/en/open_source/upgrading/2.46.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: Import Payload Changes
99

1010
Following a successful import or reimport, a JSON blob for `statistics` is generated to provide the differential of finding activity.
1111
There was a section in the `delta` JSON blob that referred to a key labeled `left untouched`. This value does not comply with REST
12-
norms, and has been renamed to `left_untouched`. Here is a before and after to make it clear:
12+
norms, and has been renamed to `untouched`. Here is a before and after to make it clear:
1313

1414
Before:
1515

@@ -32,7 +32,7 @@ After:
3232
"created": {},
3333
"closed": {},
3434
"reactivated": {},
35-
"left_untouched": {}
35+
"untouched": {}
3636
},
3737
"after": {}
3838
}

dojo/db_migrations/0226_import_history_left_untouched_rename.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
from django.db import migrations, models
44

55

6-
original_left_untouched_value = "left untouched"
7-
updated_left_untouched_value = "left_untouched"
6+
original_untouched_value = "left untouched"
7+
updated_untouched_value = "untouched"
88

99

1010
def convert_space_to_underscore(apps, schema_editor):
1111
test_import_finding_action = apps.get_model("dojo", "Test_Import_Finding_Action")
1212
for test_import_action in test_import_finding_action.objects.filter(
13-
action=original_left_untouched_value
13+
action=original_untouched_value
1414
):
15-
test_import_action.action = updated_left_untouched_value
15+
test_import_action.action = updated_untouched_value
1616
test_import_action.save()
1717

1818

1919
def convert_underscore_to_space(apps, schema_editor):
2020
test_import_finding_action = apps.get_model("dojo", "Test_Import_Finding_Action")
2121
for test_import_action in test_import_finding_action.objects.filter(
22-
action=updated_left_untouched_value
22+
action=updated_untouched_value
2323
):
24-
test_import_action.action = original_left_untouched_value
24+
test_import_action.action = original_untouched_value
2525
test_import_action.save()
2626

2727

@@ -34,7 +34,7 @@ class Migration(migrations.Migration):
3434
migrations.AlterField(
3535
model_name='test_import_finding_action',
3636
name='action',
37-
field=models.CharField(blank=True, choices=[('N', 'created'), ('C', 'closed'), ('R', 'reactivated'), ('U', 'left_untouched')], max_length=100, null=True),
37+
field=models.CharField(blank=True, choices=[('N', 'created'), ('C', 'closed'), ('R', 'reactivated'), ('U', 'untouched')], max_length=100, null=True),
3838
),
3939
migrations.RunPython(
4040
convert_space_to_underscore, reverse_code=convert_underscore_to_space

dojo/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
(IMPORT_CREATED_FINDING, "created"),
6868
(IMPORT_CLOSED_FINDING, "closed"),
6969
(IMPORT_REACTIVATED_FINDING, "reactivated"),
70-
(IMPORT_UNTOUCHED_FINDING, "left_untouched"),
70+
(IMPORT_UNTOUCHED_FINDING, "untouched"),
7171
]
7272

7373

dojo/templates/dojo/view_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ <h4 class="has-filters">
275275
{% regroup test_import.test_import_finding_action_set.all by get_action_display as finding_action_list %}
276276
<a href="{% url 'engagement_all_findings' test.engagement.id %}?test={{ test.id }}&test_import_finding_action__test_import={{ test_import.id }}">
277277
{% for action in finding_action_list %}
278-
{{ action.list|length }} {{ action.grouper|replace_underscore_with_space }}
278+
{{ action.list|length }} {{ action.grouper }}
279279
{% if not forloop.last %},{% endif %}
280280
{% empty %}
281281
There were no findings created, closed, or modified

dojo/templatetags/display_tags.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,6 @@ def remove_string(string, value):
173173
return string.replace(value, "")
174174

175175

176-
@register.filter
177-
def replace_underscore_with_space(string):
178-
return string.replace("_", " ")
179-
180-
181176
@register.filter
182177
def percentage(fraction, value):
183178
return_value = ""

unittests/test_import_reimport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ def test_import_0_reimport_1_active_verified_reimport_0_active_verified_statisti
15541554
"low": {"active": 1, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 1, "verified": 0},
15551555
"medium": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
15561556
"total": {"active": 1, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 1, "verified": 0}},
1557-
"left_untouched": {
1557+
"untouched": {
15581558
"critical": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
15591559
"high": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
15601560
"info": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
@@ -1604,7 +1604,7 @@ def test_import_0_reimport_1_active_verified_reimport_0_active_verified_statisti
16041604
"low": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
16051605
"medium": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
16061606
"total": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0}},
1607-
"left_untouched": {
1607+
"untouched": {
16081608
"critical": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
16091609
"high": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},
16101610
"info": {"active": 0, "duplicate": 0, "false_p": 0, "is_mitigated": 0, "out_of_scope": 0, "risk_accepted": 0, "total": 0, "verified": 0},

0 commit comments

Comments
 (0)