[ckan-changes] commit/ckan: dread: [tests]: #1416 Check missing params in form POST do not cause exception.

Bitbucket commits-noreply at bitbucket.org
Tue Nov 1 13:10:43 UTC 2011


1 new commit in ckan:


https://bitbucket.org/okfn/ckan/changeset/5d6a3e50fe8f/
changeset:   5d6a3e50fe8f
user:        dread
date:        2011-11-01 14:10:31
summary:     [tests]: #1416 Check missing params in form POST do not cause exception.
affected #:  1 file

diff -r 669d424d32ddafb7a7f074d3ea8739521a8798f5 -r 5d6a3e50fe8fa15de8d57f2ed269952c9e08d17a ckan/tests/functional/test_user.py
--- a/ckan/tests/functional/test_user.py
+++ b/ckan/tests/functional/test_user.py
@@ -443,7 +443,7 @@
         assert 'Password: Please enter both passwords' in main_res, main_res
         self.check_named_element(main_res, 'input', 'name="name"', 'value="%s"' % username)
 
-    def test_user_invalid_password(self):
+    def test_user_create_invalid_password(self):
         # create/register user
         username = 'testcreate4'
         password = u'tes' # Too short
@@ -463,6 +463,25 @@
         assert 'Password: Your password must be 4 characters or longer' in main_res, main_res
         self.check_named_element(main_res, 'input', 'name="name"', 'value="%s"' % username)
 
+    def test_user_create_missing_parameters(self):
+        # create/register user
+        username = 'testcreate4'
+        user = model.User.by_name(unicode(username))
+        password = u'testpassword'
+
+        offset = url_for(controller='user', action='register')
+        res = self.app.get(offset, status=200)
+        main_res = self.main_div(res)
+        assert 'Register' in main_res, main_res
+        fv = res.forms['user-edit']
+        fv['name'] = username
+        fv['password1'] = password
+        fv['password2'] = password
+        del fv.fields['email']
+        res = fv.submit('save')
+        assert "Errors in form" in res.body
+        assert "Email: Missing value" in res.body
+
     def test_user_edit(self):
         # create user
         username = 'testedit'

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list