Exemplo n.º 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())
Exemplo n.º 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."]
     )
Exemplo n.º 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."]
     )
Exemplo n.º 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."]
     )
Exemplo n.º 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."]
     )
Exemplo n.º 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())