Files
mayan-edms/mayan/apps/checkouts/tests/mixins.py
T
Roberto Rosario 456c322c19 Move add_to_class functions to their own module
* 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>
2019-04-11 18:03:53 -04:00

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
)