summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2015-06-05 14:32:26 +0800
committerJeremy Kerr <jk@ozlabs.org>2015-06-05 14:37:09 +0800
commit46e4ad955a2a7ba4f32b76a74b350140a1e3d761 (patch)
tree02892290f921f567d1778aa11ee1168e2e7c980a
parent7a39d75859c4ee908573726f0a82df85cdb8b845 (diff)
downloadpatchwork-46e4ad955a2a7ba4f32b76a74b350140a1e3d761.tar.bz2
patchwork-46e4ad955a2a7ba4f32b76a74b350140a1e3d761.tar.xz
patchwork: Explicitly load states fixtures
Apps with migrations will no longer load the initial_data fixtures by default. In order to prepare to add migrations to patchwork, rename the initial_data fixture to default_states (to match the default_tags fixture), and explicitly load them in tests that require them. Also, include this step in the INSTALL document. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--docs/INSTALL6
-rw-r--r--patchwork/fixtures/default_states.xml (renamed from patchwork/fixtures/initial_data.xml)0
-rw-r--r--patchwork/tests/test_bundles.py1
-rw-r--r--patchwork/tests/test_encodings.py2
-rw-r--r--patchwork/tests/test_expiry.py1
-rw-r--r--patchwork/tests/test_list.py1
-rw-r--r--patchwork/tests/test_mboxviews.py12
-rw-r--r--patchwork/tests/test_notifications.py3
-rw-r--r--patchwork/tests/test_patchparser.py6
-rw-r--r--patchwork/tests/test_tags.py4
-rw-r--r--patchwork/tests/test_updates.py2
11 files changed, 32 insertions, 6 deletions
diff --git a/docs/INSTALL b/docs/INSTALL
index 611fbb4..bd95770 100644
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -148,10 +148,10 @@ in brackets):
PYTHONPATH=lib/python ./manage.py collectstatic
- If you'd like to use the default tag set (Acked-by, Reviewed-by and
- Tested-by), then load these default tags:
+ You'll also need to load the initial tags and states into the
+ patchwork database:
- PYTHONPATH=lib/python ./manage.py loaddata default_tags
+ PYTHONPATH=lib/python ./manage.py loaddata default_tags default_states
Finally, add privileges for your mail and web users. This is only needed if
you use the ident-based approach. If you use password-based database
diff --git a/patchwork/fixtures/initial_data.xml b/patchwork/fixtures/default_states.xml
index 86e1105..86e1105 100644
--- a/patchwork/fixtures/initial_data.xml
+++ b/patchwork/fixtures/default_states.xml
diff --git a/patchwork/tests/test_bundles.py b/patchwork/tests/test_bundles.py
index 38f3a2c..a9ee8dd 100644
--- a/patchwork/tests/test_bundles.py
+++ b/patchwork/tests/test_bundles.py
@@ -54,6 +54,7 @@ class BundleListTest(TestCase):
self.user.delete()
class BundleTestBase(TestCase):
+ fixtures = ['default_states']
def setUp(self, patch_count=3):
patch_names = ['testpatch%d' % (i) for i in range(1, patch_count+1)]
self.user = create_user()
diff --git a/patchwork/tests/test_encodings.py b/patchwork/tests/test_encodings.py
index b9032bb..b639078 100644
--- a/patchwork/tests/test_encodings.py
+++ b/patchwork/tests/test_encodings.py
@@ -26,6 +26,7 @@ from django.test import TestCase
from django.test.client import Client
class UTF8PatchViewTest(TestCase):
+ fixtures = ['default_states']
patch_filename = '0002-utf-8.patch'
patch_encoding = 'utf-8'
@@ -63,6 +64,7 @@ class UTF8PatchViewTest(TestCase):
defaults.project.delete()
class UTF8HeaderPatchViewTest(UTF8PatchViewTest):
+ fixtures = ['default_states']
patch_filename = '0002-utf-8.patch'
patch_encoding = 'utf-8'
patch_author_name = u'P\xe4tch Author'
diff --git a/patchwork/tests/test_expiry.py b/patchwork/tests/test_expiry.py
index 844ed4b..ca22970 100644
--- a/patchwork/tests/test_expiry.py
+++ b/patchwork/tests/test_expiry.py
@@ -26,6 +26,7 @@ from patchwork.tests.utils import create_user, defaults
from patchwork.utils import do_expiry
class TestRegistrationExpiry(TestCase):
+ fixtures = ['default_states']
def register(self, date):
user = create_user()
diff --git a/patchwork/tests/test_list.py b/patchwork/tests/test_list.py
index a795a5f..c7fbbea 100644
--- a/patchwork/tests/test_list.py
+++ b/patchwork/tests/test_list.py
@@ -42,6 +42,7 @@ class EmptyPatchListTest(TestCase):
self.assertNotContains(response, 'tbody')
class PatchOrderTest(TestCase):
+ fixtures = ['default_states']
d = datetime.datetime
patchmeta = [
diff --git a/patchwork/tests/test_mboxviews.py b/patchwork/tests/test_mboxviews.py
index 0e57f42..02d04cb 100644
--- a/patchwork/tests/test_mboxviews.py
+++ b/patchwork/tests/test_mboxviews.py
@@ -29,6 +29,8 @@ from patchwork.models import Patch, Comment, Person
from patchwork.tests.utils import defaults, create_user, find_in_context
class MboxPatchResponseTest(TestCase):
+ fixtures = ['default_states']
+
""" Test that the mbox view appends the Acked-by from a patch comment """
def setUp(self):
defaults.project.save()
@@ -56,6 +58,8 @@ class MboxPatchResponseTest(TestCase):
'Acked-by: 1\nAcked-by: 2\n')
class MboxPatchSplitResponseTest(TestCase):
+ fixtures = ['default_states']
+
""" Test that the mbox view appends the Acked-by from a patch comment,
and places it before an '---' update line. """
def setUp(self):
@@ -84,6 +88,8 @@ class MboxPatchSplitResponseTest(TestCase):
'Acked-by: 1\nAcked-by: 2\n')
class MboxPassThroughHeaderTest(TestCase):
+ fixtures = ['default_states']
+
""" Test that we see 'Cc' and 'To' headers passed through from original
message to mbox view """
@@ -122,6 +128,8 @@ class MboxPassThroughHeaderTest(TestCase):
self.assertContains(response, self.date_header)
class MboxBrokenFromHeaderTest(TestCase):
+ fixtures = ['default_states']
+
""" Test that a person with characters outside ASCII in his name do
produce correct From header. As RFC 2822 state we must retain the
<user@doamin.tld> format for the mail while the name part may be coded
@@ -145,6 +153,8 @@ class MboxBrokenFromHeaderTest(TestCase):
self.assertContains(response, from_email)
class MboxDateHeaderTest(TestCase):
+ fixtures = ['default_states']
+
""" Test that the date provided in the patch mail view is correct """
def setUp(self):
@@ -181,6 +191,8 @@ class MboxDateHeaderTest(TestCase):
self.assertEqual(mail_date, date)
class MboxCommentPostcriptUnchangedTest(TestCase):
+ fixtures = ['default_states']
+
""" Test that the mbox view doesn't change the postscript part of a mail.
There where always a missing blank right after the postscript
delimiter '---' and an additional newline right before. """
diff --git a/patchwork/tests/test_notifications.py b/patchwork/tests/test_notifications.py
index ed35140..c46af61 100644
--- a/patchwork/tests/test_notifications.py
+++ b/patchwork/tests/test_notifications.py
@@ -28,6 +28,8 @@ from patchwork.tests.utils import defaults, create_maintainer
from patchwork.utils import send_notifications
class PatchNotificationModelTest(TestCase):
+ fixtures = ['default_states']
+
"""Tests for the creation & update of the PatchChangeNotification model"""
def setUp(self):
@@ -120,6 +122,7 @@ class PatchNotificationModelTest(TestCase):
self.assertEqual(PatchChangeNotification.objects.count(), 0)
class PatchNotificationEmailTest(TestCase):
+ fixtures = ['default_states']
def setUp(self):
self.project = defaults.project
diff --git a/patchwork/tests/test_patchparser.py b/patchwork/tests/test_patchparser.py
index da2b07a..58689bb 100644
--- a/patchwork/tests/test_patchparser.py
+++ b/patchwork/tests/test_patchparser.py
@@ -32,6 +32,7 @@ except ImportError:
from email.MIMEText import MIMEText
class PatchTest(TestCase):
+ fixtures = ['default_states']
default_sender = defaults.sender
default_subject = defaults.subject
project = defaults.project
@@ -246,6 +247,7 @@ class MultipleProjectPatchTest(TestCase):
""" Test that patches sent to multiple patchwork projects are
handled correctly """
+ fixtures = ['default_states']
test_comment = 'Test Comment'
patch_filename = '0001-add-line.patch'
msgid = '<1@example.com>'
@@ -449,6 +451,7 @@ class NoNewlineAtEndOfFilePatchTest(MBoxPatchTest):
self.assertEqual(2, patch.content.count('\ No newline at end of file'))
class DelegateRequestTest(TestCase):
+ fixtures = ['default_states']
patch_filename = '0001-add-line.patch'
msgid = '<1@example.com>'
invalid_delegate_email = "nobody"
@@ -494,6 +497,7 @@ class DelegateRequestTest(TestCase):
self.user.delete()
class InitialPatchStateTest(TestCase):
+ fixtures = ['default_states']
patch_filename = '0001-add-line.patch'
msgid = '<1@example.com>'
invalid_state_name = "Nonexistent Test State"
@@ -558,7 +562,7 @@ class ParseInitialTagsTest(PatchTest):
test_comment = ('test comment\n\n' +
'Tested-by: Test User <test@example.com>\n' +
'Reviewed-by: Test User <test@example.com>\n')
- fixtures = ['default_tags']
+ fixtures = ['default_tags', 'default_states']
def setUp(self):
project = defaults.project
diff --git a/patchwork/tests/test_tags.py b/patchwork/tests/test_tags.py
index f1196e7..a1e03f5 100644
--- a/patchwork/tests/test_tags.py
+++ b/patchwork/tests/test_tags.py
@@ -31,7 +31,7 @@ class ExtractTagsTest(TestCase):
email = 'test@exmaple.com'
name_email = 'test name <' + email + '>'
- fixtures = ['default_tags']
+ fixtures = ['default_tags', 'default_states']
def assertTagsEqual(self, str, acks, reviews, tests):
counts = extract_tags(str, Tag.objects.all())
@@ -83,7 +83,7 @@ class PatchTagsTest(TransactionTestCase):
ACK = 1
REVIEW = 2
TEST = 3
- fixtures = ['default_tags']
+ fixtures = ['default_tags', 'default_states']
def assertTagsEqual(self, patch, acks, reviews, tests):
patch = Patch.objects.get(pk=patch.pk)
diff --git a/patchwork/tests/test_updates.py b/patchwork/tests/test_updates.py
index 177ee78..d2f4126 100644
--- a/patchwork/tests/test_updates.py
+++ b/patchwork/tests/test_updates.py
@@ -23,6 +23,8 @@ from patchwork.models import Patch, Person, State
from patchwork.tests.utils import defaults, create_maintainer
class MultipleUpdateTest(TestCase):
+ fixtures = ['default_states']
+
def setUp(self):
defaults.project.save()
self.user = create_maintainer(defaults.project)