Skip to content

Commit

Permalink
Revert 1400-fix_dupe_changelog
Browse files Browse the repository at this point in the history
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
  • Loading branch information
TG1999 committed Mar 18, 2024
1 parent 766cb3e commit b9cd0e9
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 126 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by Django 4.1.13 on 2024-02-26 13:52
# Generated by Django 4.1.13 on 2024-03-18 08:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("vulnerabilities", "0056_alter_packagechangelog_unique_together_and_more"),
("vulnerabilities", "0054_alter_packagechangelog_software_version_and_more"),
]

operations = [
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,6 @@ def get_iso_time(self):
class Meta:
abstract = True
ordering = ("-action_time",)
unique_together = ("action_time", "actor_name", "action_type", "source_url")


class VulnerabilityHistoryManager(models.Manager):
Expand Down
50 changes: 0 additions & 50 deletions vulnerabilities/tests/test_data_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,53 +610,3 @@ def setUpBeforeMigration(self, apps):
def test_removal_of_duped_purls(self):
Package = apps.get_model("vulnerabilities", "Package")
assert Package.objects.count() == 1


class TestRemoveDupedChangeLogWithSameData(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0054_alter_packagechangelog_software_version_and_more"
migrate_to = "0055_remove_changelogs_with_same_data_different_software_version"

def setUpBeforeMigration(self, apps):
PackageChangeLog = apps.get_model("vulnerabilities", "PackageChangeLog")
VulnerabilityChangeLog = apps.get_model("vulnerabilities", "VulnerabilityChangeLog")
Package = apps.get_model("vulnerabilities", "Package")
Vulnerability = apps.get_model("vulnerabilities", "Vulnerability")
pkg1 = Package.objects.create(type="nginx", name="nginx", qualifiers={"os": "windows"})
vuln = Vulnerability.objects.create(summary="NEW")
PackageChangeLog.objects.create(
actor_name="Nginx",
action_type=1,
source_url="test",
software_version="1",
package=pkg1,
related_vulnerability=vuln,
)
PackageChangeLog.objects.create(
actor_name="Nginx",
action_type=1,
source_url="test",
software_version="2",
package=pkg1,
related_vulnerability=vuln,
)
VulnerabilityChangeLog.objects.create(
actor_name="Nginx",
action_type=1,
source_url="test",
software_version="2",
vulnerability=vuln,
)
VulnerabilityChangeLog.objects.create(
actor_name="Nginx",
action_type=1,
source_url="test",
software_version="1",
vulnerability=vuln,
)

def test_removal_of_changelog(self):
PackageChangeLog = apps.get_model("vulnerabilities", "PackageChangeLog")
VulnerabilityChangeLog = apps.get_model("vulnerabilities", "VulnerabilityChangeLog")
assert PackageChangeLog.objects.all().count() == 1
assert VulnerabilityChangeLog.objects.all().count() == 1

0 comments on commit b9cd0e9

Please sign in to comment.