Skip to content

Commit

Permalink
Skip pwd test if no pwd in environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryp Toon committed Feb 25, 2024
1 parent 2d621bf commit 8a4d817
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,16 @@ def test_security_wallet_field_encryption_password(self):
self.assertNotEqual(encrypted_main_key_private, HDKey(pk).private_byte)

def test_security_encrypted_db_incorrect_password(self):
if not(os.environ.get('DB_FIELD_ENCRYPTION_PASSWORD') or os.environ.get('DB_FIELD_ENCRYPTION_KEY')):
self.skipTest("This test only runs when no encryption keys are provided")
db = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'bitcoinlib_encrypted.db')
self.assertRaisesRegex(EncodingError, "Could not decrypt value \(password incorrect\?\): MAC check failed",
Wallet, 'wlt-encryption-test', db_uri=db)

def test_security_encrypted_db_no_password(self):
db = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'bitcoinlib_encrypted.db')
if os.environ.get('DB_FIELD_ENCRYPTION_PASSWORD') or os.environ.get('DB_FIELD_ENCRYPTION_KEY'):
self.skipTest("This test only runs when no encryption keys are provided")
db = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'bitcoinlib_encrypted.db')
self.assertRaisesRegex(ValueError, "Data is encrypted please provide key in environment",
Wallet, 'wlt-encryption-test', db_uri=db)

Expand Down

0 comments on commit 8a4d817

Please sign in to comment.