Example #1
0
 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())
Example #2
0
 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."]
     )
Example #3
0
 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."]
     )
Example #4
0
 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."]
     )
Example #5
0
 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."]
     )
Example #6
0
 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())