On 06/30/2016 12:30 PM, Stephen Finucane wrote:
This is also useful for the REST API tests.

Signed-off-by: Stephen Finucane <[email protected]>

Reviewed-by: Andy Doan <[email protected]>

diff --git a/patchwork/tests/utils.py b/patchwork/tests/utils.py

+def create_check(**kwargs):
+    """Create 'Check' object."""
+    values = {
+        'patch': create_patch(),
+        'user': create_user(),
+        'date': dt.now(),
+        'state': Check.STATE_SUCCESS,
+        'target_url': 'http://example.com/',
+        'description': '',
+        'context': 'jenkins-ci',
+    }
+    values.update(**kwargs)
+
+    check = Check(**values)
+    check.save()
+
+    return check

Its a bit of nit, but you can do that more concisely with:

    return Check.objects.create(**values)

_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to