[PATCH 0 of 9 Registration cube] Convert cube to new style

Nsukami Patrick ptrck at nskm.xyz
Wed Apr 1 12:50:03 CEST 2020

Hello everybody, really hope you're all doing fine.
The following is an attempt to move Registration cube to new style.
I have one test failing, thanks for gving me advices on how to fix it:

    def test_send_mail_ok(self):
	with self.new_access(u'anon').web_request() as req:
	    req.form = self._posted_form()
	    req.session.data['captcha'] = self.captcha_value
	    path, params = self.expect_redirect_handle_request(req, 'registration_sendmail')
	    self.assertEqual(path, '')
		req, params,
		'Your registration email has been sent. '
		'Follow instructions in there to activate your account.')
	    # check email contains activation url...
	    URL_RE = re.compile('(%s[^.]+)$' % self.config['base-url'], re.M)
	    text = MAILBOX[-1].message.get_payload(decode=True)
	    url = URL_RE.search(text).group(1)
	    # ... and the registration key contains all data
	    key = dict(parse_qsl(urlsplit(url)[3]))['key']
	    d = self._posted_form('upassword-subject-confirm')
>           self.assertDictEqual(decrypt(key, self.config['registration-cypher-seed']), d)
E           AssertionError: {'login-subject': 'toto', 'upassword-subjec[167 chars]ion'} != {'firstname-subject': 'Toto', 'surname-subj[166 chars]ion'}
E             {'__errorurl': 'registration',
E              'captcha': 'captcha value',
E              'email_address-subject': 'toto at secondweb.fr',
E              'firstname-subject': 'Toto',
E              'login-subject': 'toto',
E              'surname-subject': 'Toto',
E           -  'upassword-subject': b'toto'}
E           ?                       -
E           +  'upassword-subject': 'toto'}

test/unittest_registration.py:87: AssertionError

More information about the cubicweb-devel mailing list