summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/tests
Commit message (Collapse)AuthorAgeFilesLines
* models: use User.post_save signal to create UserProfile objectsJeremy Kerr2011-03-301-4/+1
| | | | | | | | | | Rather than relying on the registration app's callback mechanism to create the UserProfile object, use the post_save signal on auth.User. This means that the UserProfile will be created regardless of how the User was created. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Replace tab characters with spaces on .py filesGuilherme Salgado2011-03-302-2/+2
| | | | | Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views: use id__in = get_patch_ids() to get the modified patch setJeremy Kerr2011-03-091-0/+62
| | | | | | | | | | | | Currently, we generic_list processes patches in order of the patch_id:X parameter, which is arbitrarily decided by the browser. By using id__in, we get patches sorted by the default Patch model ordering. This means that the (arbitrary) order of get_patch_ids() doesn't affect the ordering of patches that we process, and bundles are created with a reasonable default patch order. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* forms: Fix archiving/unarchiving of patches on patch listsGuilherme Salgado2011-03-081-40/+51
| | | | | | | | It was broken because MultipleBooleanField() was leaking string values instead of boolens as expected by MultiplePatchForm. Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Allow pull requests to include a diffGuilherme Salgado2011-03-082-0/+154
| | | | | | | | If a patch comes along with a pull request and a diff, add both to the Patch model. Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* filters: quote param names and values when constructing querystringsJeremy Kerr2011-03-082-0/+37
| | | | | | | | | | Use urllib.quote to sanitise parameter names and values; prevents escaped ampersands in the input qs from appearing unescaped in the link output. Add a testcase for the unescaped qs fragments Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Support execution of single testsDirk Wallenstein2011-02-281-14/+5
| | | | | | | | | Django does not use suite() when executing single tests. Importing all tests directly into __init__.py has the same effect as the replaced version of suite(). Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/parser: Add test for wrapped git pull requestsJeremy Kerr2011-02-112-2/+355
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Replace tab in indentation with spaceDirk Wallenstein2011-02-112-5/+5
| | | | | Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/parser: Add subject encoding testsJeremy Kerr2011-02-112-0/+29
| | | | | | | We should now be able to decode internationalised Subject headers, so add tests for this. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add support for git-pull requestsJeremy Kerr2010-11-013-1/+368
| | | | | | | | | Add a a pull_url to the Patch object, and update the parser to look for git-pull style emails. Requires SQL migration script. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/updates: Add delegate clear testJeremy Kerr2010-09-031-5/+15
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* forms: change MultiplePatchForm from a ModelForm to a FormJeremy Kerr2010-09-031-0/+19
| | | | | | | | | | | | | ModelForm was causing validation issues, especially with no-change fields on required model fields. Add a test for updating a required field (state) through MultiplePatchForm. Change it to a normal form, and call instance.setattr manually. This makes the new test pass. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/updates: Add multiple invalid state change testJeremy Kerr2010-09-031-5/+18
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Add multiple patch update testJeremy Kerr2010-09-023-2/+74
| | | | | | | Add a test for updating mulitple patches. Currently fails with django 1.1. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/utils: Specify content encoding on MIMEText() constructionJeremy Kerr2010-08-101-6/+5
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Copy headers from original mail into patch mbox outputJeremy Kerr2009-09-301-0/+30
| | | | | | | Preserve the Cc and To headers in the mbox output by parsing the saved original headers, and adding them to the mail object. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: check some edge cases in bundle reordering testsEduardo Habkost2009-08-151-16/+35
| | | | | | | | | | | | | | | | | | While testing BundleReorderTest, I felt like adding more test cases to check if reordering is touching only the right patches on the bundle. This increases the number of patches on the test bundle to 5, and changes the code to do the following tests: - Reorder all patches - Reorder only the first 3 patches - Reorder only the last 3 patches - Reorder only the middle 3 patches - On all above tests, check if the 'order' field on the BundlePatch objects is still consistent Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Fix 'order_start' on BundleReorderTest unit testEduardo Habkost2009-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The 'order_start' parameter on the reorder form should be a patch ID, not the 'order' field of BundlePatch. This fixes the following test failure: > ====================================================================== > FAIL: testBundleReorder (patchwork.tests.bundles.BundleReorderTest) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "/mnt/common/code/admin/rh-patchwork/apps/patchwork/tests/bundles.py", line 358, in testBundleReorder > self.failUnlessEqual(response.status_code, 200) > AssertionError: 404 != 200 > > ---------------------------------------------------------------------- > Ran 123 tests in 4.527s > > FAILED (failures=1) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: allow short-form List-Id headersJeremy Kerr2009-08-011-1/+48
| | | | | | | | | | | | | | | | | Some lists (eg, nongnu.org) have short-form List-Id headers. For example: List-Id: qemu-devel.nongnu.org Although RFC 2919 prescribes that: list-id-header = "List-ID:" [phrase] "<" list-id ">" CRLF we should allow for these headers anyway. Based on an original patch from "J.H." <warthog9@kernel.org>. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: test creating bundles with existing namesJeremy Kerr2009-02-271-0/+14
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [views] Check count() for duplicate bundle patches, rather than try/exceptJeremy Kerr2009-02-131-0/+43
| | | | | | | If the exception is raised, the transaction will still be in a bad state, due to the foreign key constraint. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [views] Don't create bundles with no nameJeremy Kerr2009-02-131-0/+22
| | | | | | Check to see that we have a valid name before creating. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [mbox] Put ACKs before '---' updatesJeremy Kerr2009-02-122-2/+81
| | | | | | | | | Update the Patch's mbox() function to split into '--- update' sections, allowing us to add Acks and Signoffs in the right place Add tests too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [tests] Add initial bundle testsJeremy Kerr2009-02-103-3/+317
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [models] Make patches unique on (msgid, project), not just (msgid)Jeremy Kerr2008-10-291-2/+67
| | | | | | | | | | On patchwork.ozlabs.org, we may see multiple patches for different projects, but with the same message-id. We want these patches to show up on both projects, so we need to change the current UNIQUE contstraint on msgid. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Handle patches with no content charset definedJeremy Kerr2008-10-231-0/+11
| | | | | | If we don't have an incoming charset defined, assume utf-8. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Accept x-diff patchesJeremy Kerr2008-10-101-1/+5
| | | | | | We should accept x-diff attachments as well as x-patch. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [models] Fix exception on mbox view with non-ascii submitter nameJeremy Kerr2008-10-091-1/+24
| | | | | | | | We need to unicode the name instead of str-ing it. Add test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [encoding] Don't output patch mbox as quoted-printableJeremy Kerr2008-10-071-0/+8
| | | | | | | | git-am doesn't like quoted-printable, so output mbox files as raw 7- or 8-bit mbox files. This means we have to create a new MIMEText class, so that the content isn't automatically QP-encoded on __init__(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [models] Create patch mbox with utf-8 encodingJeremy Kerr2008-09-292-2/+58
| | | | | | | | | We were getting exceptions on the mbox view when looking at a non-ascii patch. Add test to suit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [tests] Remove print from SenderCorrelationTestJeremy Kerr2008-09-291-2/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [tests] Add tests for utf-8 patchesJeremy Kerr2008-09-293-4/+34
| | | | | | .. which expose a bug in the patch parser, so fix that. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [test] Move helper functions into tests/utils.pyJeremy Kerr2008-09-202-40/+83
| | | | | | So that we can use them for other tests Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Fix spacing for encoded headersJeremy Kerr2008-09-201-1/+1
| | | | | | We need to join the fragments with a space. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Merge senders with different caseJeremy Kerr2008-09-201-0/+41
| | | | | | ... and add tests Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [test] 2.4-ise test casesJeremy Kerr2008-09-201-2/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Decode From: headersJeremy Kerr2008-09-201-2/+45
| | | | | | | | | We're getting a few utf-8 encoded From: addresses, so decode before saving to the DB. Also, add tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Don't remove --- update linesJeremy Kerr2008-09-201-0/+24
| | | | | | | | | We'd like to keep update lines in the patch comments, so change the signature-removal code to allow them to pass through. Also, add appropriate tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [test] Add test for signatures in commentsJeremy Kerr2008-09-201-0/+13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [test] Add patchwork testing infrastructureJeremy Kerr2008-09-193-0/+131
Add a small set of initial tests for the patch parsing code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>