Esempio n. 1
0
 def test_fallback(self):
     logger = get_logger(None)
     assert logger.name == 'root'
Esempio n. 2
0
 def test_string(self):
     logger = get_logger('test123')
     assert logger.name == 'test123'
Esempio n. 3
0
 def test_method(self):
     logger = get_logger(TestClass.test)
     assert logger.name == 'keybar.tests.utils.test_logging.TestClass.test'
Esempio n. 4
0
 def test_class(self):
     logger = get_logger(TestClass)
     assert logger.name == 'keybar.tests.utils.test_logging.TestClass'
Esempio n. 5
0
 def test_function(self):
     logger = get_logger(test_func)
     assert logger.name == 'keybar.tests.utils.test_logging.test_func'
Esempio n. 6
0
from OpenSSL import crypto
from py509.x509 import (
    make_certificate,
    make_certificate_authority,
    make_certificate_signing_request,
    make_pkey,
    make_serial,
)

from keybar.utils.logging import get_logger


# Based on https://github.com/sholsapp/python-ssl-playground/blob/master/bin/generate-identities

logger = get_logger(__name__)


NOW = 0
TEN_YEARS = 10 * 365 * 24 * 60 * 60


def write_key(path, name, obj):
    with open(os.path.join(path, name + ".key"), "wb") as fh:
        fh.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, obj))


def write_cert(path, name, obj):
    with open(os.path.join(path, name + ".cert"), "wb") as fh:
        fh.write(crypto.dump_certificate(crypto.FILETYPE_PEM, obj))