Skip to content

Commit

Permalink
Fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Sep 5, 2023
1 parent 4e92500 commit f1f231e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions pubnub/pnconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def __init__(self):
self.heartbeat_default_values = True
self._presence_timeout = PNConfiguration.DEFAULT_PRESENCE_TIMEOUT
self._heartbeat_interval = PNConfiguration.DEFAULT_HEARTBEAT_INTERVAL
self.crypto_engine = None
self.file_crypto_engine = None
self.cryptor = None
self.file_cryptor = None

def validate(self):
PNConfiguration.validate_not_empty_string(self.uuid)
Expand Down Expand Up @@ -105,17 +105,17 @@ def crypto(self):
return self.crypto_instance

def _init_cryptodome(self):
if not self.crypto_engine:
if not self.cryptor:
from pubnub.crypto import PubNubCryptodome
self.crypto_engine = PubNubCryptodome
self.crypto_instance = self.crypto_engine(self)
self.cryptor = PubNubCryptodome
self.crypto_instance = self.cryptor(self)

def _init_file_crypto(self):
from .crypto import PubNubFileCrypto
if not self.file_crypto_engine:
if not self.file_cryptor:
from pubnub.crypto import PubNubFileCrypto
self.file_crypto_engine = PubNubFileCrypto
self.file_crypto_instance = self.file_crypto_engine(self)
self.file_cryptor = PubNubFileCrypto
self.file_crypto_instance = self.file_cryptor(self)

@property
def file_crypto(self) -> PubNubCrypto:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def test_get_default_crypto(self):
assert isinstance(config.crypto, PubNubCryptodome)

def test_get_custom_crypto(self):
class CustomCrypto(PubNubCrypto):
class CustomCryptor(PubNubCrypto):
pass

config = pnconf_env_copy()
config.crypto_engine = CustomCrypto
config.cryptor = CustomCryptor
assert isinstance(config.crypto, PubNubCrypto)
assert isinstance(config.crypto, CustomCrypto)
assert isinstance(config.crypto, CustomCryptor)

0 comments on commit f1f231e

Please sign in to comment.