From: Stephen Finucane Date: Mon, 20 Jun 2016 13:05:16 +0000 (+0100) Subject: tests: Clean up 'test_checks' X-Git-Tag: v2.0.0-rc1~324 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51639f0f405ea18abfdfd341e970eb96b6fc0f7a;p=thirdparty%2Fpatchwork.git tests: Clean up 'test_checks' * Make use of 'create_' helper * Remove unneeded 'XXX.objects.delete()' calls (all objects are deleted on teardown of each test) * Include every import on its own line Signed-off-by: Stephen Finucane Reviewed-by: Andy Doan --- diff --git a/patchwork/tests/test_checks.py b/patchwork/tests/test_checks.py index 2ed5070e..0508704a 100644 --- a/patchwork/tests/test_checks.py +++ b/patchwork/tests/test_checks.py @@ -22,22 +22,16 @@ from datetime import timedelta from django.test import TransactionTestCase -from patchwork.models import Patch, Check -from patchwork.tests.utils import defaults, create_user +from patchwork.models import Check +from patchwork.tests.utils import create_patches +from patchwork.tests.utils import create_user class PatchChecksTest(TransactionTestCase): fixtures = ['default_tags', 'default_states'] def setUp(self): - project = defaults.project - defaults.project.save() - defaults.patch_author_person.save() - self.patch = Patch(project=project, - msgid='x', name=defaults.patch_name, - submitter=defaults.patch_author_person, - diff='') - self.patch.save() + self.patch = create_patches()[0] self.user = create_user() def create_check(self, **kwargs): @@ -89,9 +83,6 @@ class PatchChecksTest(TransactionTestCase): if state not in state_counts: self.assertEqual(counts[state], 0) - def tearDown(self): - self.patch.delete() - def test_checks__no_checks(self): self.assertChecksEqual(self.patch, [])