예제 #1
0
def test_gen_non_ca_cert():
    tmp_dir = tempfile.mkdtemp()

    main(['--ca', '-f', 'CA', '-d', tmp_dir])
    ca_key = os.path.join(tmp_dir, 'CA.key')
    ca_crt = os.path.join(tmp_dir, 'CA.crt')
    assert check_key_cert_match(ca_key, ca_crt)

    gen_non_ca_cert('device', tmp_dir, 500, ['127.0.0.1'], [], ca_crt, ca_key)
    key = os.path.join(tmp_dir, 'device.key')
    crt = os.path.join(tmp_dir, 'device.crt')
    assert check_key_cert_match(key, crt)
예제 #2
0
def test_gen_non_ca_cert():
    tmp_dir = tempfile.mkdtemp()

    main(['--ca', '-f', 'CA', '-d', tmp_dir])
    ca_key = os.path.join(tmp_dir, 'CA.key')
    ca_crt = os.path.join(tmp_dir, 'CA.crt')
    assert check_key_cert_match(ca_key, ca_crt)

    gen_non_ca_cert('device', tmp_dir, 500, ['127.0.0.1'], [], ca_crt, ca_key)
    key = os.path.join(tmp_dir, 'device.key')
    crt = os.path.join(tmp_dir, 'device.crt')
    assert check_key_cert_match(key, crt)
예제 #3
0
def test_gen_non_ca_cert_shell():
    tmp_dir = tempfile.mkdtemp()

    key = os.path.join(tmp_dir, 'device.key')
    crt = os.path.join(tmp_dir, 'device.crt')
    main(['-f', 'device', '-d', tmp_dir])
    assert check_key_cert_match(key, crt)
예제 #4
0
def test_gen_non_ca_cert_shell():
    tmp_dir = tempfile.mkdtemp()

    key = os.path.join(tmp_dir, 'device.key')
    crt = os.path.join(tmp_dir, 'device.crt')
    main(['-f', 'device', '-d', tmp_dir])
    assert check_key_cert_match(key, crt)
예제 #5
0
def test_run_module_as_script():
    tmp_dir = tempfile.mkdtemp()

    key = os.path.join(tmp_dir, 'device.key')
    crt = os.path.join(tmp_dir, 'device.crt')

    subprocess.call('python -m koi.keygen -d {} -f device'.format(tmp_dir),
                    shell=True)
    assert check_key_cert_match(key, crt)
예제 #6
0
def test_run_module_as_script():
    tmp_dir = tempfile.mkdtemp()

    key = os.path.join(tmp_dir, 'device.key')
    crt = os.path.join(tmp_dir, 'device.crt')

    subprocess.call(
        'python -m koi.keygen -d {} -f device'.format(tmp_dir),
        shell=True)
    assert check_key_cert_match(key, crt)
예제 #7
0
def test_gen_ca_cert():
    tmp_dir = tempfile.mkdtemp()
    main(['--ca', '-f', 'PRIVATE_CA', '-d', tmp_dir])
    key = os.path.join(tmp_dir, 'PRIVATE_CA.key')
    crt = os.path.join(tmp_dir, 'PRIVATE_CA.crt')
    assert check_key_cert_match(key, crt)
예제 #8
0
def test_key_cert_match():
    key = os.path.join(DEFAULT_CERTS_DIR, 'localhost.key')
    crt = os.path.join(DEFAULT_CERTS_DIR, 'localhost.crt')
    assert check_key_cert_match(key, crt)
예제 #9
0
def test_gen_ca_cert():
    tmp_dir = tempfile.mkdtemp()
    main(['--ca', '-f', 'PRIVATE_CA', '-d', tmp_dir])
    key = os.path.join(tmp_dir, 'PRIVATE_CA.key')
    crt = os.path.join(tmp_dir, 'PRIVATE_CA.crt')
    assert check_key_cert_match(key, crt)
예제 #10
0
def test_key_cert_match():
    key = os.path.join(DEFAULT_CERTS_DIR, 'localhost.key')
    crt = os.path.join(DEFAULT_CERTS_DIR, 'localhost.crt')
    assert check_key_cert_match(key, crt)