--- a/devtools/test/unittest_testlib.py Thu Feb 05 19:36:49 2015 +0100
+++ b/devtools/test/unittest_testlib.py Wed Feb 25 17:13:46 2015 +0100
@@ -28,6 +28,25 @@
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.pytestconf import clean_repo_test_cls
+class FakeFormTC(TestCase):
+ def test_fake_form(self):
+ class entity:
+ cw_etype = 'Entity'
+ eid = 0
+ sio = StringIO('hop\n')
+ form = CubicWebTC.fake_form('import',
+ {'file': ('filename.txt', sio),
+ 'encoding': u'utf-8',
+ }, [(entity, {'field': 'value'})])
+ self.assertEqual(form, {'__form_id': 'import',
+ '__maineid': 0,
+ '__type:0': 'Entity',
+ '_cw_entity_fields:0': '__type,field',
+ '_cw_fields': 'file,encoding',
+ 'eid': [0],
+ 'encoding': u'utf-8',
+ 'field:0': 'value',
+ 'file': ('filename.txt', sio)})
class WebTestTC(TestCase):