* The new module is called methods.py and found on each app. * Add keyword arguments to add_to_class instances. * Remove catch all exception handling for the check in and check out views. * Improve checkouts tests code reducing redundant code. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
21 lines
549 B
Python
21 lines
549 B
Python
from __future__ import unicode_literals
|
|
|
|
import datetime
|
|
|
|
from django.utils.timezone import now
|
|
|
|
from ..models import DocumentCheckout
|
|
|
|
|
|
class DocumentCheckoutTestMixin(object):
|
|
def _check_out_document(self, user=None):
|
|
if not user:
|
|
user = self.user
|
|
|
|
expiration_datetime = now() + datetime.timedelta(days=1)
|
|
|
|
self.test_check_out = DocumentCheckout.objects.check_out_document(
|
|
document=self.document, expiration_datetime=expiration_datetime,
|
|
user=user, block_new_version=True
|
|
)
|