20 |
20 |
from wcs.qommon import evalutils
|
21 |
21 |
from wcs.qommon.http_request import HTTPRequest
|
22 |
22 |
from wcs.qommon.backoffice.listing import pagination_links
|
|
23 |
from wcs.qommon.emails import email as send_email, docutils
|
23 |
24 |
|
24 |
25 |
from utilities import get_app, create_temporary_pub, clean_temporary_pub
|
25 |
26 |
|
... | ... | |
278 |
279 |
'1', '…', '8', '9', '10', '11', '12', '13', '14', '…', '50', '(101-110/500)', 'Per page: ', '10', '20', '50', '100']
|
279 |
280 |
assert get_texts(pagination_links(100, 20, 500)) == [
|
280 |
281 |
'1', '…', '3', '4', '5', '6', '7', '8', '9', '…', '25', '(101-120/500)', 'Per page: ', '10', '20', '50', '100']
|
|
282 |
|
|
283 |
def test_email_signature_plain(emails):
|
|
284 |
pub = create_temporary_pub()
|
|
285 |
pub.cfg['emails'] = {'footer': 'Footer\nText'}
|
|
286 |
send_email('test', mail_body='Hello', email_rcpt='test@localhost', want_html=False)
|
|
287 |
assert not emails.emails['test']['msg'].is_multipart()
|
|
288 |
assert 'Footer\nText' in emails.emails['test']['msg'].get_payload()
|
|
289 |
|
|
290 |
@pytest.mark.skipif('docutils is None')
|
|
291 |
def test_email_signature_rst(emails):
|
|
292 |
pub = create_temporary_pub()
|
|
293 |
pub.cfg['emails'] = {'footer': 'Footer\nText'}
|
|
294 |
send_email('test', mail_body='Hello', email_rcpt='test@localhost')
|
|
295 |
assert emails.emails['test']['msg'].get_payload()[0].get_content_type() == 'text/plain'
|
|
296 |
assert emails.emails['test']['msg'].get_payload()[1].get_content_type() == 'text/html'
|
|
297 |
assert 'Footer\nText' in emails.emails['test']['msg'].get_payload()[0].get_payload()
|
|
298 |
assert '>Footer</div>' in emails.emails['test']['msg'].get_payload()[1].get_payload()
|