Skip to content

Commit

Permalink
Merge pull request #15 from Synse/short-secret-tests
Browse files Browse the repository at this point in the history
Update short secret raise tests
  • Loading branch information
cschmidt0121 authored Nov 1, 2024
2 parents e8a6b48 + 9cfa98b commit fa8a07f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_encrypt_nosalt(self):
self.assertEqual(ciphertext, "$1$2+1yGuQ1gcMK")

def test_encrypt_raises_value_error_short_secret(self):
with self.assertRaises(ValueError):
with self.assertRaisesRegex(ValueError, "^secret too short, need 16 bytes, got 15$"):
splunk_secret = base64.b64encode(os.urandom(255))[:15]
splunksecrets.encrypt(splunk_secret, "temp1234")

Expand Down Expand Up @@ -138,7 +138,7 @@ def test_decrypt(self):
self.assertEqual(plaintext, "temp1234")

def test_decrypt_raises_value_error_short_secret1(self):
with self.assertRaises(ValueError):
with self.assertRaisesRegex(ValueError, "^secret too short, need 16 bytes, got 15$"):
splunk_secret = base64.b64encode(os.urandom(255))[:15]
splunksecrets.decrypt(splunk_secret, "$1$n6g0W7F51ZAK")

Expand Down

0 comments on commit fa8a07f

Please sign in to comment.