Extending certificate tests.
This commit is contained in:
parent
9def00d1a2
commit
7123e77edf
|
@ -12,28 +12,28 @@ from flask import jsonify
|
||||||
|
|
||||||
from lemur import factory
|
from lemur import factory
|
||||||
|
|
||||||
from lemur.users.views import mod as users
|
from lemur.users.views import mod as users_bp
|
||||||
from lemur.roles.views import mod as roles
|
from lemur.roles.views import mod as roles_bp
|
||||||
from lemur.auth.views import mod as auth
|
from lemur.auth.views import mod as auth_bp
|
||||||
from lemur.domains.views import mod as domains
|
from lemur.domains.views import mod as domains_bp
|
||||||
from lemur.elbs.views import mod as elbs
|
from lemur.elbs.views import mod as elbs_bp
|
||||||
from lemur.accounts.views import mod as accounts
|
from lemur.accounts.views import mod as accounts_bp
|
||||||
from lemur.authorities.views import mod as authorities
|
from lemur.authorities.views import mod as authorities_bp
|
||||||
from lemur.listeners.views import mod as listeners
|
from lemur.listeners.views import mod as listeners_bp
|
||||||
from lemur.certificates.views import mod as certificates
|
from lemur.certificates.views import mod as certificates_bp
|
||||||
from lemur.status.views import mod as status
|
from lemur.status.views import mod as status_bp
|
||||||
|
|
||||||
LEMUR_BLUEPRINTS = (
|
LEMUR_BLUEPRINTS = (
|
||||||
users,
|
users_bp,
|
||||||
roles,
|
roles_bp,
|
||||||
auth,
|
auth_bp,
|
||||||
domains,
|
domains_bp,
|
||||||
elbs,
|
elbs_bp,
|
||||||
accounts,
|
accounts_bp,
|
||||||
authorities,
|
authorities_bp,
|
||||||
listeners,
|
listeners_bp,
|
||||||
certificates,
|
certificates_bp,
|
||||||
status
|
status_bp
|
||||||
)
|
)
|
||||||
|
|
||||||
def create_app(config=None):
|
def create_app(config=None):
|
||||||
|
|
|
@ -180,4 +180,42 @@ F74P1wKBgQCPQGKLUcfAvjIcZp4ECH0K8sBEmoEf8pceuALZ3H5vneYDzqMDIceo
|
||||||
t5Gpocpt77LJnNiszXSerj/KjX2MflY5xUXeekWowLVTBOK5+CZ8+XBIgBt1hIG3
|
t5Gpocpt77LJnNiszXSerj/KjX2MflY5xUXeekWowLVTBOK5+CZ8+XBIgBt1hIG3
|
||||||
XKxcRgm/Va4QMEAnec0qXfdTVJaJiAW0bdKwKRRrrbwcTdNRGibdng==
|
XKxcRgm/Va4QMEAnec0qXfdTVJaJiAW0bdKwKRRrrbwcTdNRGibdng==
|
||||||
-----END RSA PRIVATE KEY-----
|
-----END RSA PRIVATE KEY-----
|
||||||
|
"""
|
||||||
|
|
||||||
|
CSR_CONFIG = """
|
||||||
|
# Configuration for standard CSR generation for Netflix
|
||||||
|
# Used for procuring VeriSign certificates
|
||||||
|
# Author: jbob
|
||||||
|
# Contact: security@example.com
|
||||||
|
|
||||||
|
[ req ]
|
||||||
|
# Use a 2048 bit private key
|
||||||
|
default_bits = 2048
|
||||||
|
default_keyfile = key.pem
|
||||||
|
prompt = no
|
||||||
|
encrypt_key = no
|
||||||
|
|
||||||
|
# base request
|
||||||
|
distinguished_name = req_distinguished_name
|
||||||
|
|
||||||
|
# extensions
|
||||||
|
# Uncomment the following line if you are requesting a SAN cert
|
||||||
|
#req_extensions = req_ext
|
||||||
|
|
||||||
|
# distinguished_name
|
||||||
|
[ req_distinguished_name ]
|
||||||
|
countryName = "US" # C=
|
||||||
|
stateOrProvinceName = "CALIFORNIA" # ST=
|
||||||
|
localityName = "A place" # L=
|
||||||
|
organizationName = "Example, Inc." # O=
|
||||||
|
organizationalUnitName = "Operations" # OU=
|
||||||
|
# This is the hostname/subject name on the certificate
|
||||||
|
commonName = "example.net" # CN=
|
||||||
|
|
||||||
|
[ req_ext ]
|
||||||
|
# Uncomment the following line if you are requesting a SAN cert
|
||||||
|
#subjectAltName = @alt_names
|
||||||
|
|
||||||
|
[alt_names]
|
||||||
|
# Put your SANs here
|
||||||
"""
|
"""
|
|
@ -1,4 +1,6 @@
|
||||||
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
from mock import mock_open, patch
|
||||||
from lemur.certificates.views import *
|
from lemur.certificates.views import *
|
||||||
|
|
||||||
#def test_crud(session):
|
#def test_crud(session):
|
||||||
|
@ -32,7 +34,12 @@ def test_private_key_str():
|
||||||
|
|
||||||
|
|
||||||
def test_create_csr():
|
def test_create_csr():
|
||||||
assert 1 == 2
|
from lemur.tests.certs import CSR_CONFIG
|
||||||
|
from lemur.certificates.service import create_csr
|
||||||
|
m = mock_open()
|
||||||
|
with patch('lemur.certificates.service.open', m, create=True):
|
||||||
|
path = create_csr(CSR_CONFIG)
|
||||||
|
assert path == ''
|
||||||
|
|
||||||
|
|
||||||
def test_create_path():
|
def test_create_path():
|
||||||
|
|
Loading…
Reference in New Issue