Example #1
0
def test_write_new_locked_object():
    with pytest.raises(ValueError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-cert.pem'), 'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=ObjectId.IFX_CERT)
Example #2
0
def test_write_new_faulty_objid():
    with pytest.raises(TypeError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-cert.pem'), 'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=0xE0E0)
Example #3
0
def test_write_new_faulty_objid():
    LOGGER.info('Write new certificate in a fault Certificate Slot')
    with pytest.raises(TypeError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-cert.pem'), 'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=0xE0E0)
Example #4
0
def test_write_new_faulty_cert():
    with pytest.raises(ValueError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-faulty-cert.pem'),
                'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=ObjectId.USER_CERT_1)
Example #5
0
def test_write_new_faulty_cert():
    LOGGER.info('Try to write an false formated certificate')
    with pytest.raises(ValueError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-faulty-cert.pem'),
                'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=ObjectId.USER_CERT_1)
Example #6
0
def test_write_new_specific():
    LOGGER.info('Write new certificate in a specific slot')
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes, certid=ObjectId.USER_CERT_1)
Example #7
0
def test_write_new_default():
    LOGGER.info('Write new certificate in a default slot')
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes)
Example #8
0
def test_write_new_specific():
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes, certid=ObjectId.USER_CERT_1)
Example #9
0
def test_write_new_default():
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes)