def test_matching_keys_accepted(self): good_request = { 'key': 'this is my good secret key', 'key2': 'this is my good secret key' } form = NewSecretKeyForm(good_request) self.assertTrue(form.is_valid())
def test_too_short_key_rejected(self): bad_request = {'key': 'key', 'key2': 'key'} form = NewSecretKeyForm(bad_request) self.assertFalse(form.is_valid()) self.assertEqual( form.errors['key'], ["Your password isn't strong enough."] )
def test_nonmatching_keys_rejected(self): bad_request = {'key': 'this is a key', 'key2': 'this is also a key'} form = NewSecretKeyForm(bad_request) self.assertFalse(form.is_valid()) self.assertEqual( form.errors['key2'], ["The two passphrase fields didn't match."] )
def test_matching_keys_accepted(self): good_request = {'key': 'this is my good secret key', 'key2': 'this is my good secret key'} form = NewSecretKeyForm(good_request) self.assertTrue(form.is_valid())