Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly state app name in TestMigration #1012

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion vulnerabilities/tests/test_data_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
class TestMigrations(TestCase):
@property
def app(self):
return apps.get_containing_app_config(type(self).__module__).name
return apps.get_containing_app_config(self.app_name).name

app_name = None
migrate_from = None
migrate_to = None

Expand Down Expand Up @@ -51,6 +52,7 @@ def setUpBeforeMigration(self, apps):


class DuplicateSeverityTestCase(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0013_auto_20220503_0941"
migrate_to = "0014_remove_duplicate_severities"

Expand Down Expand Up @@ -95,6 +97,7 @@ def test_remove_duplicate_rows(self):


class DropVulnerabilityFromSeverityTestCase(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0014_remove_duplicate_severities"
migrate_to = "0015_alter_vulnerabilityseverity_unique_together_and_more"

Expand All @@ -114,6 +117,7 @@ def test_dropping_vulnerability_from_severity(self):


class UpdateCPEURL(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0015_alter_vulnerabilityseverity_unique_together_and_more"
migrate_to = "0016_update_cpe_url"

Expand All @@ -138,6 +142,7 @@ def test_cpe_url_update(self):


class TestCvssVectorMigrationToScoringElementComputeNewScores(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0031_vulnerabilityseverity_scoring_elements"
migrate_to = "0032_vulnerabilityseverity_merge_cvss_score_and_vector"

Expand Down Expand Up @@ -240,6 +245,7 @@ def test_compute_cvss(self):


class TestCvssVectorMigrationToScoringElementMergeRows(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0031_vulnerabilityseverity_scoring_elements"
migrate_to = "0032_vulnerabilityseverity_merge_cvss_score_and_vector"

Expand Down Expand Up @@ -448,6 +454,7 @@ def test_merge_rows(self):


class TestCvssVectorMigrationToScoringElementMergeRowsWithDupes(TestMigrations):
app_name = "vulnerabilities"
migrate_from = "0031_vulnerabilityseverity_scoring_elements"
migrate_to = "0032_vulnerabilityseverity_merge_cvss_score_and_vector"

Expand Down