add docseal
This commit is contained in:
36
enrollments-events/tests/test_docseal.py
Normal file
36
enrollments-events/tests/test_docseal.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import base64
|
||||
import uuid
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from docseal import create_submission_from_pdf
|
||||
|
||||
SUBJECT = '{first_name}, assine seu certificado agora!'
|
||||
MESSAGE = """
|
||||
{first_name},
|
||||
Seu certificado já está pronto e aguardando apenas a sua assinatura digital.
|
||||
|
||||
[👉 Assinar agora.]({{submitter.link}})
|
||||
"""
|
||||
|
||||
|
||||
def test_create_submission_from_pdf():
|
||||
r = MagicMock()
|
||||
|
||||
with patch('docseal.requests.post', r):
|
||||
with open('tests/sample.pdf', 'rb') as f:
|
||||
file = base64.b64encode(f.read())
|
||||
create_submission_from_pdf(
|
||||
str(uuid.uuid4()),
|
||||
file=file.decode('utf-8'),
|
||||
email_message={
|
||||
'subject': SUBJECT.format(first_name='Tiago'),
|
||||
'body': MESSAGE.format(first_name='Tiago'),
|
||||
},
|
||||
submitters=[
|
||||
{
|
||||
'role': 'Aluno',
|
||||
'name': 'Sérgio R Siqueira',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
},
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user