Beispiel #1
0
def test_get_pem_text_from_file_parses_the_pem_file(lti_config_environ):
    pem_key = os.environ.get('LTI13_PRIVATE_KEY')
    certs = pem.parse_file(pem_key)
    with patch.object(pem, 'parse_file',
                      return_value=certs) as mock_pem_parse_file:
        get_pem_text_from_file(pem_key)
        assert mock_pem_parse_file.called
Beispiel #2
0
def test_get_pem_text_from_file_raises_an_error_if_parse_method_returns_empty_list(
):
    with patch.object(pem, 'parse_file',
                      return_value=[]) as mock_pem_parse_file:
        with pytest.raises(Exception):
            get_pem_text_from_file('file.pem')
Beispiel #3
0
def test_get_pem_text_from_file_raises_an_error_if_pem_cannot_be_read():
    with pytest.raises(PermissionError):
        get_pem_text_from_file('file.pem')