Fixes in tests and html escaping
This commit is contained in:
parent
9e1e48e0e9
commit
61a2d53308
10 changed files with 77 additions and 22 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from settings import config
|
||||
from paramecio.cromosoma.webmodel import WebModel
|
||||
from paramecio.cromosoma import corefields
|
||||
from paramecio.cromosoma.extrafields.emailfield import EmailField
|
||||
import unittest
|
||||
|
||||
class TestFieldMethods(unittest.TestCase):
|
||||
|
|
@ -21,7 +22,7 @@ class TestFieldMethods(unittest.TestCase):
|
|||
|
||||
value=field.check("injection_'")
|
||||
|
||||
self.assertEqual(value, "injection_\\'")
|
||||
self.assertEqual(value, "injection_'")
|
||||
|
||||
def test_integerfield(self):
|
||||
|
||||
|
|
@ -40,4 +41,19 @@ class TestFieldMethods(unittest.TestCase):
|
|||
value=integerfield.check("25'")
|
||||
|
||||
self.assertEqual(value, "0")
|
||||
|
||||
|
||||
def test_emailfield(self):
|
||||
|
||||
emailfield=EmailField('email')
|
||||
|
||||
emailfield.required=True
|
||||
|
||||
emailfield.check('exampleweb-t-sys.com')
|
||||
|
||||
self.assertTrue(emailfield.error)
|
||||
|
||||
emailfield.check('example@web-t-sys.com')
|
||||
|
||||
self.assertFalse(emailfield.error)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from settings import config
|
||||
from paramecio.citoplasma import sendmail
|
||||
import time
|
||||
import unittest
|
||||
|
||||
class TestFieldMethods(unittest.TestCase):
|
||||
|
|
@ -8,10 +9,14 @@ class TestFieldMethods(unittest.TestCase):
|
|||
|
||||
s=sendmail.SendMail()
|
||||
|
||||
self.assertTrue( s.send(config.portal_email, config.email_test, 'This is a test', 'A message for test a simple email method', content_type='plain', attachments=[]) )
|
||||
self.assertTrue( s.send(config.portal_email, [config.email_test], 'This is a test', 'A message for test a simple email method', content_type='plain', attachments=[]) )
|
||||
|
||||
self.assertTrue( s.send(config.portal_email, config.email_test, 'This is a test', 'A message for test a simple email method in <b>html</b>', content_type='html', attachments=[]) )
|
||||
time.sleep(70)
|
||||
|
||||
self.assertTrue( s.send(config.portal_email, config.email_test, 'This is a test', 'A message for test a simple email method in <b>html</b> and attachments', content_type='html', attachments=['tests/images/image.jpg']) )
|
||||
self.assertTrue( s.send(config.portal_email, [config.email_test], 'This is a test', 'A message for test a simple email method in <b>html</b>', content_type='html', attachments=[]) )
|
||||
|
||||
s.quit()
|
||||
time.sleep(70)
|
||||
|
||||
self.assertTrue( s.send(config.portal_email, [config.email_test], 'This is a test', 'A message for test a simple email method in <b>html</b> and attachments', content_type='html', attachments=['tests/images/image.jpg']) )
|
||||
|
||||
s.quit()
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class TestWebModelMethods(unittest.TestCase):
|
|||
|
||||
print('Select and save in an array')
|
||||
|
||||
self.assertEqual(model.select_to_array(['title', 'content']), {1: {'title': 'Example title Updated', 'content': 'New content Updated'}})
|
||||
self.assertEqual(model.select_to_array(['title', 'content']), [{'id': 1, 'title': 'Example title Updated', 'content': 'New content Updated'}])
|
||||
|
||||
model.yes_reset_conditions=True
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue