This is an example on how to mock a file with string.
Testing a function which opens a file and does some kind of operation on it.
# Python 3.7 | |
import io | |
import unittest | |
import unittest.mock | |
# -- function -- | |
def print_hello_world() -> None: | |
print('Hello World!') | |
import threading | |
class SharingChecker: | |
number: int = 0 | |
def increment(self) -> None: | |
SharingChecker.number += 1 | |
High level error codes | |
0x1080 PEM - No PEM header or footer found | |
0x1100 PEM - PEM string is not as expected | |
0x1180 PEM - Failed to allocate memory | |
0x1200 PEM - RSA IV is not in hex-format | |
0x1280 PEM - Unsupported key encryption algorithm | |
0x1300 PEM - Private key password can't be empty | |
0x1380 PEM - Given private key password does not allow for correct decryption | |
0x1400 PEM - Unavailable feature, e.g. hashing/encryption combination |