Files
mayan-edms/mayan/apps/document_signatures/tests/mixins.py
T
Roberto Rosario 4937d8b776 Update document signatures app
Add keyword arguments.

Remove source column functions and move their code to the model.

Use the FilteredSelectionForm for the key selection in the
document version signing view.

Update the field definition of the DetailForm subclasses
to use the new internface.

Update URL parameters to use the "_id" form.

Update views filtering to comply with MERC 6.

Move repeated test code to its own test mixin.

Update links to work with the new Link class interface.

Modernize tests.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2019-01-25 01:32:05 -04:00

23 lines
756 B
Python

from __future__ import absolute_import, unicode_literals
from django.core.files import File
from mayan.apps.django_gpg.models import Key
from ..models import DetachedSignature
from .literals import TEST_KEY_FILE, TEST_SIGNATURE_FILE_PATH
class SignaturesTestMixin(object):
def _create_test_key(self):
with open(TEST_KEY_FILE, mode='rb') as file_object:
self.test_key = Key.objects.create(key_data=file_object.read())
def _upload_test_signature(self):
with open(TEST_SIGNATURE_FILE_PATH, mode='rb') as file_object:
self.test_signature = DetachedSignature.objects.create(
document_version=self.test_document.latest_version,
signature_file=File(file_object)
)