def test_decrypt_file(self, mock_decrypt_file): """ Test the decrypt_file method with mocked values. """ file = mock.MagicMock() key = mock.MagicMock() XORCipher.decrypt_string = mock.MagicMock(return_value=True) XORCipher.decrypt_string(file, key) XORCipher.decrypt_string.assert_called_with(file, key)
def test_encrypt_file(self, mock_encrypt_file): """ Test the encrypt_file method with mocked values. """ file = mock.MagicMock() key = mock.MagicMock() XORCipher.encrypt_file = mock.MagicMock(return_value=True) XORCipher.encrypt_file(file, key) XORCipher.encrypt_file.assert_called_with(file, key)
def test_decrypt_string(self, mock_decrypt_string): """ Test the decrypt_string method with mocked values. """ ans = mock.MagicMock() content = mock.MagicMock() key = mock.MagicMock() XORCipher.decrypt_string = mock.MagicMock(return_value=ans) XORCipher.decrypt_string(content, key) XORCipher.decrypt_string.assert_called_with(content, key)
def test_encrypt(self, mock_encrypt): """ Test the encrypt method with mocked values. """ ans = mock.MagicMock() content = mock.MagicMock() key = mock.MagicMock() XORCipher.encrypt = mock.MagicMock(return_value=ans) XORCipher.encrypt(content, key) XORCipher.encrypt.assert_called_with(content, key)
def test__init__(self, mock__init__): """ Test the __init__ method with commented values in the event one needs to instantiate mocked objects on the method. """ # self.XORCipher_1.__init__ = mock.MagicMock() XORCipher.__init__ = mock.MagicMock() # self.XORCipher_1.__init__(1) XORCipher.__init__() # self.XORCipher_1.__init__.assert_called_with(1) XORCipher.__init__.assert_called()