summaryrefslogtreecommitdiff
path: root/patchwork/tests
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2020-03-03 10:46:37 +0000
committerStephen Finucane <stephen@that.guru>2020-04-26 13:45:45 +0100
commitac0e4de9f56eb90d816a320f70d87c45d702432e (patch)
treef5f2f517c730af186cb405d3b17f866c41e14d03 /patchwork/tests
parent0686a736fbf6d869bd31bd135ba38080ac96de22 (diff)
downloadpatchwork-ac0e4de9f56eb90d816a320f70d87c45d702432e.tar
patchwork-ac0e4de9f56eb90d816a320f70d87c45d702432e.tar.gz
models: Merge 'Patch' and 'Submission'
Oh, the follies of youth. Time to undo the damage of 2.0.0, specifically commit 86172ccc16, which split Patch into two separate models using concrete inheritance. As noted previously, this introduced a large number of unavoidable JOINs across large tables and the performance impacts these introduce are blocking other features we want, such as improved tagging functionality. To combine these two models, we must do the following: - Update any references to the 'Patch' model to point to the 'Submission' model instead - Move everything from 'Patch' to 'Submission', including both fields and options - Delete the 'Patch' model - Rename the 'Submission' model to 'Patch' With this change, our model "hierarchy" goes from: Submission Patch PatchComment Cover CoverComment To a nice, flat: Patch PatchComment Cover CoverComment I expect this migration to be intensive, particularly for MySQL users who will see their entire tables rewritten. Unfortunately I don't see any way to resolve this in an easier manner. Signed-off-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'patchwork/tests')
-rw-r--r--patchwork/tests/test_mboxviews.py26
-rw-r--r--patchwork/tests/utils.py5
2 files changed, 19 insertions, 12 deletions
diff --git a/patchwork/tests/test_mboxviews.py b/patchwork/tests/test_mboxviews.py
index a7b0186..1535c5c 100644
--- a/patchwork/tests/test_mboxviews.py
+++ b/patchwork/tests/test_mboxviews.py
@@ -268,9 +268,12 @@ class MboxSeriesDependencies(TestCase):
def test_patch_with_wildcard_series(self):
_, patch_a, patch_b = self._create_patches()
- response = self.client.get('%s?series=*' % reverse(
- 'patch-mbox', args=[patch_b.patch.project.linkname,
- patch_b.patch.url_msgid]))
+ response = self.client.get(
+ '%s?series=*' % reverse(
+ 'patch-mbox',
+ args=[patch_b.project.linkname, patch_b.url_msgid],
+ ),
+ )
self.assertContains(response, patch_a.content)
self.assertContains(response, patch_b.content)
@@ -279,9 +282,12 @@ class MboxSeriesDependencies(TestCase):
series, patch_a, patch_b = self._create_patches()
response = self.client.get('%s?series=%d' % (
- reverse('patch-mbox', args=[patch_b.patch.project.linkname,
- patch_b.patch.url_msgid]),
- series.id))
+ reverse(
+ 'patch-mbox',
+ args=[patch_b.project.linkname, patch_b.url_msgid],
+ ),
+ series.id,
+ ))
self.assertContains(response, patch_a.content)
self.assertContains(response, patch_b.content)
@@ -291,8 +297,12 @@ class MboxSeriesDependencies(TestCase):
for value in ('foo', str(series.id + 1)):
response = self.client.get('%s?series=%s' % (
- reverse('patch-mbox', args=[patch_b.patch.project.linkname,
- patch_b.patch.url_msgid]), value))
+ reverse(
+ 'patch-mbox',
+ args=[patch_b.project.linkname, patch_b.url_msgid]
+ ),
+ value,
+ ))
self.assertEqual(response.status_code, 404)
diff --git a/patchwork/tests/utils.py b/patchwork/tests/utils.py
index 83bd66a..c464979 100644
--- a/patchwork/tests/utils.py
+++ b/patchwork/tests/utils.py
@@ -191,9 +191,6 @@ def create_patch(**kwargs):
}
values.update(kwargs)
- if 'patch_project' not in values:
- values['patch_project'] = values['project']
-
patch = Patch.objects.create(**values)
if series:
@@ -312,7 +309,7 @@ def create_series_reference(**kwargs):
def _create_submissions(create_func, count=1, **kwargs):
- """Create 'count' Submission-based objects.
+ """Create 'count' SubmissionMixin-based objects.
Args:
count (int): Number of patches to create