Add link tests. Add checkout info view tests. Move common code to a test mixin. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
19 lines
524 B
Python
19 lines
524 B
Python
from __future__ import unicode_literals
|
|
|
|
import datetime
|
|
|
|
from django.utils.timezone import now
|
|
|
|
from ..models import DocumentCheckout
|
|
|
|
|
|
class DocumentCheckoutTestMixin(object):
|
|
def _checkout_document(self):
|
|
expiration_datetime = now() + datetime.timedelta(days=1)
|
|
|
|
DocumentCheckout.objects.checkout_document(
|
|
document=self.document, expiration_datetime=expiration_datetime,
|
|
user=self.user, block_new_version=True
|
|
)
|
|
self.assertTrue(self.document.is_checked_out())
|