diff --git a/lemur/certificates/service.py b/lemur/certificates/service.py index 7600b059..581e2388 100644 --- a/lemur/certificates/service.py +++ b/lemur/certificates/service.py @@ -316,11 +316,11 @@ def create_csr(csr_config): x509.BasicConstraints(ca=False, path_length=None), critical=True, ) - for k, v in csr_config.get('extensions', {}).items(): - if k == 'subAltNames': - builder = builder.add_extension( - x509.SubjectAlternativeName([x509.DNSName(n) for n in v]), critical=True, - ) + #for k, v in csr_config.get('extensions', {}).items(): + # if k == 'subAltNames': + # builder = builder.add_extension( + # x509.SubjectAlternativeName([x509.DNSName(n) for n in v]), critical=True, + # ) # TODO support more CSR options, none of the authorities support these atm # builder.add_extension( diff --git a/lemur/tests/conftest.py b/lemur/tests/conftest.py index c4f1a4a8..b0a777aa 100644 --- a/lemur/tests/conftest.py +++ b/lemur/tests/conftest.py @@ -46,7 +46,6 @@ def app(): ctx.pop() - @pytest.yield_fixture(scope="session") def db(app, request): _db.drop_all() @@ -73,7 +72,6 @@ def session(db, request): @pytest.yield_fixture(scope="function") -def client(app, session): - with app.test_client() as client: - yield client +def client(app, session, client): + yield client diff --git a/lemur/tests/test_accounts.py b/lemur/tests/test_accounts.py index 2712947c..7665bfc6 100644 --- a/lemur/tests/test_accounts.py +++ b/lemur/tests/test_accounts.py @@ -22,11 +22,11 @@ def test_account_get(client): def test_account_post(client): - assert client.post(api.url_for(Accounts, account_id=1), {}).status_code == 405 + assert client.post(api.url_for(Accounts, account_id=1), data={}).status_code == 405 def test_account_put(client): - assert client.put(api.url_for(Accounts, account_id=1), {}).status_code == 401 + assert client.put(api.url_for(Accounts, account_id=1), data={}).status_code == 401 def test_account_delete(client): @@ -34,7 +34,7 @@ def test_account_delete(client): def test_account_patch(client): - assert client.patch(api.url_for(Accounts, account_id=1), {}).status_code == 405 + assert client.patch(api.url_for(Accounts, account_id=1), data={}).status_code == 405 VALID_USER_HEADER_TOKEN = { @@ -45,7 +45,7 @@ def test_auth_account_get(client): def test_auth_account_post_(client): - assert client.post(api.url_for(Accounts, account_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Accounts, account_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_account_put(client): @@ -57,7 +57,7 @@ def test_auth_account_delete(client): def test_auth_account_patch(client): - assert client.patch(api.url_for(Accounts, account_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Accounts, account_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 VALID_ADMIN_HEADER_TOKEN = { @@ -68,7 +68,7 @@ def test_admin_account_get(client): def test_admin_account_post(client): - assert client.post(api.url_for(Accounts, account_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Accounts, account_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_account_put(client): @@ -80,7 +80,7 @@ def test_admin_account_delete(client): def test_admin_account_patch(client): - assert client.patch(api.url_for(Accounts, account_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Accounts, account_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_accounts_get(client): @@ -88,11 +88,11 @@ def test_accounts_get(client): def test_accounts_post(client): - assert client.post(api.url_for(AccountsList), {}).status_code == 401 + assert client.post(api.url_for(AccountsList), data={}).status_code == 401 def test_accounts_put(client): - assert client.put(api.url_for(AccountsList), {}).status_code == 405 + assert client.put(api.url_for(AccountsList), data={}).status_code == 405 def test_accounts_delete(client): @@ -100,7 +100,7 @@ def test_accounts_delete(client): def test_accounts_patch(client): - assert client.patch(api.url_for(AccountsList), {}).status_code == 405 + assert client.patch(api.url_for(AccountsList), data={}).status_code == 405 def test_auth_accounts_get(client): @@ -108,7 +108,7 @@ def test_auth_accounts_get(client): def test_auth_accounts_post(client): - assert client.post(api.url_for(AccountsList), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 403 + assert client.post(api.url_for(AccountsList), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 403 def test_admin_accounts_get(client): diff --git a/lemur/tests/test_authorities.py b/lemur/tests/test_authorities.py index e55db48a..e66147e5 100644 --- a/lemur/tests/test_authorities.py +++ b/lemur/tests/test_authorities.py @@ -16,11 +16,11 @@ def test_authority_get(client): def test_authority_post(client): - assert client.post(api.url_for(Authorities, authority_id=1), {}).status_code == 405 + assert client.post(api.url_for(Authorities, authority_id=1), data={}).status_code == 405 def test_authority_put(client): - assert client.put(api.url_for(Authorities, authority_id=1), {}).status_code == 401 + assert client.put(api.url_for(Authorities, authority_id=1), data={}).status_code == 401 def test_authority_delete(client): @@ -28,7 +28,7 @@ def test_authority_delete(client): def test_authority_patch(client): - assert client.patch(api.url_for(Authorities, authority_id=1), {}).status_code == 405 + assert client.patch(api.url_for(Authorities, authority_id=1), data={}).status_code == 405 def test_authorities_get(client): @@ -36,11 +36,11 @@ def test_authorities_get(client): def test_authorities_post(client): - assert client.post(api.url_for(AuthoritiesList), {}).status_code == 401 + assert client.post(api.url_for(AuthoritiesList), data={}).status_code == 401 def test_authorities_put(client): - assert client.put(api.url_for(AuthoritiesList), {}).status_code == 405 + assert client.put(api.url_for(AuthoritiesList), data={}).status_code == 405 def test_authorities_delete(client): @@ -48,7 +48,7 @@ def test_authorities_delete(client): def test_authorities_patch(client): - assert client.patch(api.url_for(AuthoritiesList), {}).status_code == 405 + assert client.patch(api.url_for(AuthoritiesList), data={}).status_code == 405 def test_certificate_authorities_get(client): @@ -56,11 +56,11 @@ def test_certificate_authorities_get(client): def test_certificate_authorities_post(client): - assert client.post(api.url_for(AuthoritiesList), {}).status_code == 401 + assert client.post(api.url_for(AuthoritiesList), data={}).status_code == 401 def test_certificate_authorities_put(client): - assert client.put(api.url_for(AuthoritiesList), {}).status_code == 405 + assert client.put(api.url_for(AuthoritiesList), data={}).status_code == 405 def test_certificate_authorities_delete(client): @@ -68,7 +68,7 @@ def test_certificate_authorities_delete(client): def test_certificate_authorities_patch(client): - assert client.patch(api.url_for(AuthoritiesList), {}).status_code == 405 + assert client.patch(api.url_for(AuthoritiesList), data={}).status_code == 405 VALID_USER_HEADER_TOKEN = { @@ -80,7 +80,7 @@ def test_auth_authority_get(client): def test_auth_authority_post_(client): - assert client.post(api.url_for(Authorities, authority_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Authorities, authority_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_authority_put(client): @@ -92,7 +92,7 @@ def test_auth_authority_delete(client): def test_auth_authority_patch(client): - assert client.patch(api.url_for(Authorities, authority_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Authorities, authority_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_authorities_get(client): @@ -100,7 +100,7 @@ def test_auth_authorities_get(client): def test_auth_authorities_post(client): - assert client.post(api.url_for(AuthoritiesList), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 400 + assert client.post(api.url_for(AuthoritiesList), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 400 def test_auth_certificates_authorities_get(client): @@ -116,7 +116,7 @@ def test_admin_authority_get(client): def test_admin_authority_post(client): - assert client.post(api.url_for(Authorities, authority_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Authorities, authority_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_authority_put(client): @@ -136,11 +136,11 @@ def test_admin_authorities_get(client): def test_admin_authorities_post(client): - assert client.post(api.url_for(AuthoritiesList), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 400 + assert client.post(api.url_for(AuthoritiesList), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 400 def test_admin_authorities_put(client): - assert client.put(api.url_for(AuthoritiesList), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(AuthoritiesList), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_authorities_delete(client): diff --git a/lemur/tests/test_certificates.py b/lemur/tests/test_certificates.py index 4dc23a6c..5990c09c 100644 --- a/lemur/tests/test_certificates.py +++ b/lemur/tests/test_certificates.py @@ -1,16 +1,6 @@ import pytest from lemur.certificates.views import * -#def test_crud(session): -# role = create('role1') -# assert role.id > 0 -# -# role = update(role.id, 'role_new', None, []) -# assert role.name == 'role_new' -# delete(role.id) -# assert get(role.id) == None - - def test_valid_authority(session): assert 1 == 2 @@ -50,7 +40,7 @@ def test_create_basic_csr(): assert name.value in csr_config.values() -def test_import_certificate(session): +def test_import_certificate(): assert 1 == 2 @@ -133,20 +123,17 @@ def test_create_name(): True ) == 'SAN-example.com-ExampleInc-20150507-20150512' -def test_is_expired(): - assert 1 == 2 - def test_certificate_get(client): assert client.get(api.url_for(Certificates, certificate_id=1)).status_code == 401 def test_certificate_post(client): - assert client.post(api.url_for(Certificates, certificate_id=1), {}).status_code == 405 + assert client.post(api.url_for(Certificates, certificate_id=1), data={}).status_code == 405 def test_certificate_put(client): - assert client.put(api.url_for(Certificates, certificate_id=1), {}).status_code == 401 + assert client.put(api.url_for(Certificates, certificate_id=1), data={}).status_code == 401 def test_certificate_delete(client): @@ -154,7 +141,7 @@ def test_certificate_delete(client): def test_certificate_patch(client): - assert client.patch(api.url_for(Certificates, certificate_id=1), {}).status_code == 405 + assert client.patch(api.url_for(Certificates, certificate_id=1), data={}).status_code == 405 def test_certificates_get(client): @@ -162,11 +149,11 @@ def test_certificates_get(client): def test_certificates_post(client): - assert client.post(api.url_for(CertificatesList), {}).status_code == 401 + assert client.post(api.url_for(CertificatesList), data={}).status_code == 401 def test_certificates_put(client): - assert client.put(api.url_for(CertificatesList), {}).status_code == 405 + assert client.put(api.url_for(CertificatesList), data={}).status_code == 405 def test_certificates_delete(client): @@ -174,7 +161,7 @@ def test_certificates_delete(client): def test_certificates_patch(client): - assert client.patch(api.url_for(CertificatesList), {}).status_code == 405 + assert client.patch(api.url_for(CertificatesList), data={}).status_code == 405 def test_certificate_credentials_get(client): @@ -182,11 +169,11 @@ def test_certificate_credentials_get(client): def test_certificate_credentials_post(client): - assert client.post(api.url_for(CertificatePrivateKey, certificate_id=1), {}).status_code == 405 + assert client.post(api.url_for(CertificatePrivateKey, certificate_id=1), data={}).status_code == 405 def test_certificate_credentials_put(client): - assert client.put(api.url_for(CertificatePrivateKey, certificate_id=1), {}).status_code == 405 + assert client.put(api.url_for(CertificatePrivateKey, certificate_id=1), data={}).status_code == 405 def test_certificate_credentials_delete(client): @@ -194,7 +181,7 @@ def test_certificate_credentials_delete(client): def test_certificate_credentials_patch(client): - assert client.patch(api.url_for(CertificatePrivateKey, certificate_id=1), {}).status_code == 405 + assert client.patch(api.url_for(CertificatePrivateKey, certificate_id=1), data={}).status_code == 405 def test_certificates_upload_get(client): @@ -202,11 +189,11 @@ def test_certificates_upload_get(client): def test_certificates_upload_post(client): - assert client.post(api.url_for(CertificatesUpload), {}).status_code == 401 + assert client.post(api.url_for(CertificatesUpload), data={}).status_code == 401 def test_certificates_upload_put(client): - assert client.put(api.url_for(CertificatesUpload), {}).status_code == 405 + assert client.put(api.url_for(CertificatesUpload), data={}).status_code == 405 def test_certificates_upload_delete(client): @@ -214,7 +201,7 @@ def test_certificates_upload_delete(client): def test_certificates_upload_patch(client): - assert client.patch(api.url_for(CertificatesUpload), {}).status_code == 405 + assert client.patch(api.url_for(CertificatesUpload), data={}).status_code == 405 VALID_USER_HEADER_TOKEN = { @@ -226,7 +213,7 @@ def test_auth_certificate_get(client): def test_auth_certificate_post_(client): - assert client.post(api.url_for(Certificates, certificate_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Certificates, certificate_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_certificate_put(client): @@ -238,7 +225,7 @@ def test_auth_certificate_delete(client): def test_auth_certificate_patch(client): - assert client.patch(api.url_for(Certificates, certificate_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Certificates, certificate_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_certificates_get(client): @@ -246,7 +233,7 @@ def test_auth_certificates_get(client): def test_auth_certificates_post(client): - assert client.post(api.url_for(CertificatesList), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 400 + assert client.post(api.url_for(CertificatesList), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 400 def test_auth_certificate_credentials_get(client): @@ -254,11 +241,11 @@ def test_auth_certificate_credentials_get(client): def test_auth_certificate_credentials_post(client): - assert client.post(api.url_for(CertificatePrivateKey, certificate_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(CertificatePrivateKey, certificate_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_certificate_credentials_put(client): - assert client.put(api.url_for(CertificatePrivateKey, certificate_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(CertificatePrivateKey, certificate_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_certificate_credentials_delete(client): @@ -266,7 +253,7 @@ def test_auth_certificate_credentials_delete(client): def test_auth_certificate_credentials_patch(client): - assert client.patch(api.url_for(CertificatePrivateKey, certificate_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(CertificatePrivateKey, certificate_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_certificates_upload_get(client): @@ -274,11 +261,11 @@ def test_auth_certificates_upload_get(client): def test_auth_certificates_upload_post(client): - assert client.post(api.url_for(CertificatesUpload), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 400 + assert client.post(api.url_for(CertificatesUpload), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 400 def test_auth_certificates_upload_put(client): - assert client.put(api.url_for(CertificatesUpload), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(CertificatesUpload), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_certificates_upload_delete(client): @@ -286,7 +273,7 @@ def test_auth_certificates_upload_delete(client): def test_auth_certificates_upload_patch(client): - assert client.patch(api.url_for(CertificatesUpload), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(CertificatesUpload), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 VALID_ADMIN_HEADER_TOKEN = { @@ -298,7 +285,7 @@ def test_admin_certificate_get(client): def test_admin_certificate_post(client): - assert client.post(api.url_for(Certificates, certificate_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Certificates, certificate_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_certificate_put(client): @@ -310,7 +297,7 @@ def test_admin_certificate_delete(client): def test_admin_certificate_patch(client): - assert client.patch(api.url_for(Certificates, certificate_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Certificates, certificate_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_certificates_get(client): @@ -324,7 +311,7 @@ def test_admin_certificate_credentials_get(client): def test_admin_certificate_credentials_post(client): - assert client.post(api.url_for(CertificatePrivateKey, certificate_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(CertificatePrivateKey, certificate_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_certificate_credentials_put(client): @@ -336,5 +323,5 @@ def test_admin_certificate_credentials_delete(client): def test_admin_certificate_credentials_patch(client): - assert client.patch(api.url_for(CertificatePrivateKey, certificate_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(CertificatePrivateKey, certificate_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 diff --git a/lemur/tests/test_domains.py b/lemur/tests/test_domains.py index 9d57f142..e8f94728 100644 --- a/lemur/tests/test_domains.py +++ b/lemur/tests/test_domains.py @@ -5,11 +5,11 @@ def test_domain_get(client): def test_domain_post(client): - assert client.post(api.url_for(Domains, domain_id=1), {}).status_code == 405 + assert client.post(api.url_for(Domains, domain_id=1), data={}).status_code == 405 def test_domain_put(client): - assert client.put(api.url_for(Domains, domain_id=1), {}).status_code == 405 + assert client.put(api.url_for(Domains, domain_id=1), data={}).status_code == 405 def test_domain_delete(client): @@ -17,7 +17,7 @@ def test_domain_delete(client): def test_domain_patch(client): - assert client.patch(api.url_for(Domains, domain_id=1), {}).status_code == 405 + assert client.patch(api.url_for(Domains, domain_id=1), data={}).status_code == 405 VALID_USER_HEADER_TOKEN = { @@ -28,7 +28,7 @@ def test_auth_domain_get(client): def test_auth_domain_post_(client): - assert client.post(api.url_for(Domains, domain_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Domains, domain_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_domain_put(client): @@ -40,7 +40,7 @@ def test_auth_domain_delete(client): def test_auth_domain_patch(client): - assert client.patch(api.url_for(Domains, domain_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Domains, domain_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 VALID_ADMIN_HEADER_TOKEN = { @@ -51,7 +51,7 @@ def test_admin_domain_get(client): def test_admin_domain_post(client): - assert client.post(api.url_for(Domains, domain_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Domains, domain_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_domain_put(client): @@ -63,7 +63,7 @@ def test_admin_domain_delete(client): def test_admin_domain_patch(client): - assert client.patch(api.url_for(Domains, domain_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Domains, domain_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_domains_get(client): @@ -71,11 +71,11 @@ def test_domains_get(client): def test_domains_post(client): - assert client.post(api.url_for(DomainsList), {}).status_code == 405 + assert client.post(api.url_for(DomainsList), data={}).status_code == 405 def test_domains_put(client): - assert client.put(api.url_for(DomainsList), {}).status_code == 405 + assert client.put(api.url_for(DomainsList), data={}).status_code == 405 def test_domains_delete(client): @@ -83,7 +83,7 @@ def test_domains_delete(client): def test_domains_patch(client): - assert client.patch(api.url_for(DomainsList), {}).status_code == 405 + assert client.patch(api.url_for(DomainsList), data={}).status_code == 405 def test_auth_domains_get(client): @@ -101,11 +101,11 @@ def test_certificate_domains_get(client): def test_certificate_domains_post(client): - assert client.post(api.url_for(CertificateDomains, certificate_id=1), {}).status_code == 405 + assert client.post(api.url_for(CertificateDomains, certificate_id=1), data={}).status_code == 405 def test_certificate_domains_put(client): - assert client.put(api.url_for(CertificateDomains, certificate_id=1), {}).status_code == 405 + assert client.put(api.url_for(CertificateDomains, certificate_id=1), data={}).status_code == 405 def test_certificate_domains_delete(client): @@ -113,7 +113,7 @@ def test_certificate_domains_delete(client): def test_certificate_domains_patch(client): - assert client.patch(api.url_for(CertificateDomains, certificate_id=1), {}).status_code == 405 + assert client.patch(api.url_for(CertificateDomains, certificate_id=1), data={}).status_code == 405 def test_auth_certificate_domains_get(client): diff --git a/lemur/tests/test_pack/challenge.txt b/lemur/tests/test_pack/challenge.txt deleted file mode 100644 index 21c7ddb9..00000000 --- a/lemur/tests/test_pack/challenge.txt +++ /dev/null @@ -1 +0,0 @@ -KRPZPA&*!_~%dbnuzf153594 \ No newline at end of file diff --git a/lemur/tests/test_pack/csr_config.txt b/lemur/tests/test_pack/csr_config.txt deleted file mode 100644 index 0704e5bc..00000000 --- a/lemur/tests/test_pack/csr_config.txt +++ /dev/null @@ -1,38 +0,0 @@ - - # Configuration for standard CSR generation for Netflix - # Used for procuring VeriSign certificates - # Author: jachan - # Contact: cloudsecurity@netflix.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 = "Los Gatos" # L= - organizationName = "Netflix, Inc." # O= - organizationalUnitName = "Operations" # OU= - # This is the hostname/subject name on the certificate - commonName = "dfdsflkj.net" # CN= - - [ req_ext ] - # Uncomment the following line if you are requesting a SAN cert - #subjectAltName = @alt_names - - [alt_names] - # Put your SANs here - - \ No newline at end of file diff --git a/lemur/tests/test_pack/private.key b/lemur/tests/test_pack/private.key deleted file mode 100644 index a70fee5f..00000000 --- a/lemur/tests/test_pack/private.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAvNudwW+UeQqkpY71MIdEg501AFlPKuOXG2xU8DZhvZS6dKv+ -kDmIWdEqodDgkQiy0jyTgTwxwRqDSw96R6ZgrXefUoJJo66aCsosTBZtVaE85f1L -bj2+3U678c+rekUdkrnGcGCo6b8QtdvBpiDy2clneox8tSvmffAdcR1uCv/790/k -PzQ/djWDX9JcBRyDkcTJwYC0/ek7URvA/+MXmgUL13T+gWKqduaKuIBlFetonDjn -nO11QUBiusIuHV62wzKn8m5Nc+4XoaBR0YWMFn/g6qXDYrwfCsMpka7vSWJFv5Ff -yf+7kY3wU4xIwU2vXlIDcCsdUu6b/pYoQ0YOsQIDAQABAoIBAGbFH6iWnnXrq8MH -8zcQNOFmF+RztRgCt0TOA76f6TowB/LbcXBsTl2J7CgYMUvbLuwm2KHX7r9FPTMI -XiNFT5C16rYMfiQbLGo4sDhLb/3L+wawem6oHQfzA2VH++lSWRByFaEriF+CgIZl -6pALl/uZlLzkXCx+kjPwCSV3vV0wFkDnNs6+wPrz2IhkePsuC8J0QKQLlwsES2It -Gizzhpehdv9lc9MyZC//1QlD9gMDl5ok5Bt1Xm2c12XUEEcLlKQkJxiOrBOfXPmV -PHCdLc7gZO30hc6dyQ1SSnLpywhz/a0ir2GMvkMbS5hculpcZmwEcdZl1HYD8ObP -yOMbPE0CgYEA4LVGJKGtbM8RiBB0MstxNstMYVJ4mXB0lSQ0RazdO3S3ojn+oLpF -b2pvV6m9WnHiCGigWkzhqtGGCo6aqE0MoiR4jTN8GhiZz4ggDDaVgc4Px5reUD+r -tRsTpBHseGQ+ODGgkMI8eJYkdyqkECkYjAOrdy6uorvgxUAZecRIfJMCgYEA1yhM -7NidTNRuA+huS5GcQwQweTM6P1qF7Kfk1JYQMVu4gibLZiLHlWCyHI9lrbI7IaMm -g/4jXXoewv7IvyrrSEFulkPeVWxCe3mjfQ8JANfUj4kuR915LSn4lX2pbUgUS66K -vJSUJtnzLUmb8khLEcOmDbmTFZl8D/bTHFFZlisCgYAeelfWNhuoq3lMRDcOgKuN -bAujE6WJ4kfdxrhUTvr+ynjxxv3zXPB4CS6q7Dnjn5ix3UcKmGzvV1Xf7rGpbDHv -eBTlyfrmKzoJfQQjw++JWKKpRycqKUin2tFSKqAxQB90Tb7ig4XiMTMm+qCgFILg -0sqZ8rn7FpKJDoWmD2ppgwKBgG2Dl9QeVcKbhfv7PNi+HvmFkl6+knFY1D4nHzSN -xWQ6OWoV8QXlwgzokQA0hR6qT6rJbntUyg90b1/1a5zSbbvzgiR+GxcD6bsLqQmo -s354XTtKKgJuWpWAfYUp1ylGvP3gs8FVJyu3WC2+/9+MqJk8KrNlt9YQr7M4gTAy -wBTNAoGAGU7Po4uI3xDKGLLK/ot3D3P8U9ByfeLlrUZtTz1PASsMOr92bkXmUPlE -DYUd5uFfwwlvbMNT1Ooeyrzg3bARd9B6ATyMkOaJeGoQwFAI468iucnm9rNXB+/t -U2rbIi1pXSm8zSNEY85tf6C8DU/5YbcAPf47a2UYhwCpYAJfMk0= ------END RSA PRIVATE KEY----- diff --git a/lemur/tests/test_pack/request.csr b/lemur/tests/test_pack/request.csr deleted file mode 100644 index 7b2eecf5..00000000 --- a/lemur/tests/test_pack/request.csr +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICvzCCAacCAQAwejELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNBTElGT1JOSUEx -EjAQBgNVBAcTCUxvcyBHYXRvczEWMBQGA1UEChMNTmV0ZmxpeCwgSW5jLjETMBEG -A1UECxMKT3BlcmF0aW9uczEVMBMGA1UEAxMMZGZkc2Zsa2oubmV0MIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvNudwW+UeQqkpY71MIdEg501AFlPKuOX -G2xU8DZhvZS6dKv+kDmIWdEqodDgkQiy0jyTgTwxwRqDSw96R6ZgrXefUoJJo66a -CsosTBZtVaE85f1Lbj2+3U678c+rekUdkrnGcGCo6b8QtdvBpiDy2clneox8tSvm -ffAdcR1uCv/790/kPzQ/djWDX9JcBRyDkcTJwYC0/ek7URvA/+MXmgUL13T+gWKq -duaKuIBlFetonDjnnO11QUBiusIuHV62wzKn8m5Nc+4XoaBR0YWMFn/g6qXDYrwf -CsMpka7vSWJFv5Ffyf+7kY3wU4xIwU2vXlIDcCsdUu6b/pYoQ0YOsQIDAQABoAAw -DQYJKoZIhvcNAQEFBQADggEBAE8b0+IYGiR64Me/L0/njYvSR5WR4EnjW99Sc8X5 -k93zpk4hExrZhrlkDBA/jUHhBZcPNV9w/YkhSu5ubPjRp9gRM2d4B9gGJFAs+bwe -LS9hCOxWIMKgvaBMEDQFcwqAv6kEJzmrIa7LtWS39wNfdko2hANtm7z9qskc8bPr -265+Z48DwSNCF4RPhVp9eDifjHrj0I//GMXYa92uvgj1BlPo/SGMS+XFQF779p2b -622HmUCop3pYeIyYd6rirvl9+KwqvIhm2MqHk62eHOK7Bn/FPev8OUDeV6pIvvSV -UxsEHjjLm0V/lOD65lROc7dTq4jO5PkpoKnFQDgV5v0Bf/k= ------END CERTIFICATE REQUEST----- diff --git a/lemur/tests/test_pack/server.crt b/lemur/tests/test_pack/server.crt deleted file mode 100644 index 64ec5358..00000000 --- a/lemur/tests/test_pack/server.crt +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDcDCCAlgCCQC8msHu/aa61zANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV -UzETMBEGA1UECBMKQ0FMSUZPUk5JQTESMBAGA1UEBxMJTG9zIEdhdG9zMRYwFAYD -VQQKEw1OZXRmbGl4LCBJbmMuMRMwEQYDVQQLEwpPcGVyYXRpb25zMRUwEwYDVQQD -EwxkZmRzZmxrai5uZXQwHhcNMTQwNTI1MTczMDMzWhcNMTUwNTI1MTczMDMzWjB6 -MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ0FMSUZPUk5JQTESMBAGA1UEBxMJTG9z -IEdhdG9zMRYwFAYDVQQKEw1OZXRmbGl4LCBJbmMuMRMwEQYDVQQLEwpPcGVyYXRp -b25zMRUwEwYDVQQDEwxkZmRzZmxrai5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQC8253Bb5R5CqSljvUwh0SDnTUAWU8q45cbbFTwNmG9lLp0q/6Q -OYhZ0Sqh0OCRCLLSPJOBPDHBGoNLD3pHpmCtd59SgkmjrpoKyixMFm1VoTzl/Utu -Pb7dTrvxz6t6RR2SucZwYKjpvxC128GmIPLZyWd6jHy1K+Z98B1xHW4K//v3T+Q/ -ND92NYNf0lwFHIORxMnBgLT96TtRG8D/4xeaBQvXdP6BYqp25oq4gGUV62icOOec -7XVBQGK6wi4dXrbDMqfybk1z7hehoFHRhYwWf+DqpcNivB8KwymRru9JYkW/kV/J -/7uRjfBTjEjBTa9eUgNwKx1S7pv+lihDRg6xAgMBAAEwDQYJKoZIhvcNAQEFBQAD -ggEBAJHwa4l2iSiFBb6wVFBJEWEt31qp+njiVCoTg2OJzCT60Xb26hkrsiTldIIh -eB9+y+fwdfwopzWhkNbIOlCfudx/uxtpor8/3BRbjSlNwDUg2L8pfAircJMFLQUM -O6nqPOBWCe8hXwe9FQM/oFOavf/AAw/FED+892xlytjirK9u3B28O20W11+fY7hp -8LQVBrMoVxFeLWmmwETAltJ7HEYutplRzYTM0vLBARl4Vd5kLJlY3j2Dp1ZpRGcg -CrQp26UD/oaAPGtiZQSC4LJ+4JfOuuqbm3CI24QMCh9rxv3ZoOQnFuC+7cZgqrat -V4bxCrVvWhrrDSgy9+A80NVzQ3k= ------END CERTIFICATE----- diff --git a/lemur/tests/test_roles.py b/lemur/tests/test_roles.py index b40e0772..7339aeb4 100644 --- a/lemur/tests/test_roles.py +++ b/lemur/tests/test_roles.py @@ -18,11 +18,11 @@ def test_role_get(client): def test_role_post(client): - assert client.post(api.url_for(Roles, role_id=1), {}).status_code == 405 + assert client.post(api.url_for(Roles, role_id=1), data={}).status_code == 405 def test_role_put(client): - assert client.put(api.url_for(Roles, role_id=1), {}).status_code == 401 + assert client.put(api.url_for(Roles, role_id=1), data={}).status_code == 401 def test_role_delete(client): @@ -30,7 +30,7 @@ def test_role_delete(client): def test_role_patch(client): - assert client.patch(api.url_for(Roles, role_id=1), {}).status_code == 405 + assert client.patch(api.url_for(Roles, role_id=1), data={}).status_code == 405 def test_roles_get(client): @@ -38,11 +38,11 @@ def test_roles_get(client): def test_roles_post(client): - assert client.post(api.url_for(RolesList), {}).status_code == 401 + assert client.post(api.url_for(RolesList), data={}).status_code == 401 def test_roles_put(client): - assert client.put(api.url_for(RolesList), {}).status_code == 405 + assert client.put(api.url_for(RolesList), data={}).status_code == 405 def test_roles_delete(client): @@ -50,7 +50,7 @@ def test_roles_delete(client): def test_roles_patch(client): - assert client.patch(api.url_for(RolesList), {}).status_code == 405 + assert client.patch(api.url_for(RolesList), data={}).status_code == 405 def test_role_credentials_get(client): @@ -58,11 +58,11 @@ def test_role_credentials_get(client): def test_role_credentials_post(client): - assert client.post(api.url_for(RoleViewCredentials, role_id=1), {}).status_code == 405 + assert client.post(api.url_for(RoleViewCredentials, role_id=1), data={}).status_code == 405 def test_role_credentials_put(client): - assert client.put(api.url_for(RoleViewCredentials, role_id=1), {}).status_code == 405 + assert client.put(api.url_for(RoleViewCredentials, role_id=1), data={}).status_code == 405 def test_role_credentials_delete(client): @@ -70,7 +70,7 @@ def test_role_credentials_delete(client): def test_role_credentials_patch(client): - assert client.patch(api.url_for(RoleViewCredentials, role_id=1), {}).status_code == 405 + assert client.patch(api.url_for(RoleViewCredentials, role_id=1), data={}).status_code == 405 def test_user_roles_get(client): @@ -78,11 +78,11 @@ def test_user_roles_get(client): def test_user_roles_post(client): - assert client.post(api.url_for(UserRolesList, user_id=1), {}).status_code == 405 + assert client.post(api.url_for(UserRolesList, user_id=1), data={}).status_code == 405 def test_user_roles_put(client): - assert client.put(api.url_for(UserRolesList, user_id=1), {}).status_code == 405 + assert client.put(api.url_for(UserRolesList, user_id=1), data={}).status_code == 405 def test_user_roles_delete(client): @@ -90,7 +90,7 @@ def test_user_roles_delete(client): def test_user_roles_patch(client): - assert client.patch(api.url_for(UserRolesList, user_id=1), {}).status_code == 405 + assert client.patch(api.url_for(UserRolesList, user_id=1), data={}).status_code == 405 def test_authority_roles_get(client): @@ -98,11 +98,11 @@ def test_authority_roles_get(client): def test_authority_roles_post(client): - assert client.post(api.url_for(AuthorityRolesList, authority_id=1), {}).status_code == 405 + assert client.post(api.url_for(AuthorityRolesList, authority_id=1), data={}).status_code == 405 def test_authority_roles_put(client): - assert client.put(api.url_for(AuthorityRolesList, authority_id=1), {}).status_code == 405 + assert client.put(api.url_for(AuthorityRolesList, authority_id=1), data={}).status_code == 405 def test_authority_roles_delete(client): @@ -110,7 +110,7 @@ def test_authority_roles_delete(client): def test_authority_roles_patch(client): - assert client.patch(api.url_for(AuthorityRolesList, authority_id=1), {}).status_code == 405 + assert client.patch(api.url_for(AuthorityRolesList, authority_id=1), data={}).status_code == 405 VALID_USER_HEADER_TOKEN = { @@ -122,7 +122,7 @@ def test_auth_role_get(client): def test_auth_role_post_(client): - assert client.post(api.url_for(Roles, role_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Roles, role_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_role_put(client): @@ -134,7 +134,7 @@ def test_auth_role_delete(client): def test_auth_role_patch(client): - assert client.patch(api.url_for(Roles, role_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Roles, role_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_roles_get(client): @@ -142,7 +142,7 @@ def test_auth_roles_get(client): def test_auth_roles_post(client): - assert client.post(api.url_for(RolesList), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 403 + assert client.post(api.url_for(RolesList), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 403 def test_auth_role_credentials_get(client): @@ -150,11 +150,11 @@ def test_auth_role_credentials_get(client): def test_auth_role_credentials_post(client): - assert client.post(api.url_for(RoleViewCredentials, role_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(RoleViewCredentials, role_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_role_credentials_put(client): - assert client.put(api.url_for(RoleViewCredentials, role_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(RoleViewCredentials, role_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_role_credentials_delete(client): @@ -162,7 +162,7 @@ def test_auth_role_credentials_delete(client): def test_auth_role_credentials_patch(client): - assert client.patch(api.url_for(RoleViewCredentials, role_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(RoleViewCredentials, role_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_user_roles_get(client): @@ -170,11 +170,11 @@ def test_auth_user_roles_get(client): def test_auth_user_roles_post(client): - assert client.post(api.url_for(UserRolesList, user_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(UserRolesList, user_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_user_roles_put(client): - assert client.put(api.url_for(UserRolesList, user_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(UserRolesList, user_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_user_roles_delete(client): @@ -182,7 +182,7 @@ def test_auth_user_roles_delete(client): def test_auth_user_roles_patch(client): - assert client.patch(api.url_for(UserRolesList, user_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(UserRolesList, user_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_authority_roles_get(client): @@ -190,11 +190,11 @@ def test_auth_authority_roles_get(client): def test_auth_authority_roles_post(client): - assert client.post(api.url_for(AuthorityRolesList, authority_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(AuthorityRolesList, authority_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_authority_roles_put(client): - assert client.put(api.url_for(AuthorityRolesList, authority_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(AuthorityRolesList, authority_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 def test_auth_authority_roles_delete(client): @@ -202,7 +202,7 @@ def test_auth_authority_roles_delete(client): def test_auth_authority_roles_patch(client): - assert client.patch(api.url_for(AuthorityRolesList, authority_id=1), {}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(AuthorityRolesList, authority_id=1), data={}, headers=VALID_USER_HEADER_TOKEN).status_code == 405 VALID_ADMIN_HEADER_TOKEN = { @@ -214,7 +214,7 @@ def test_admin_role_get(client): def test_admin_role_post(client): - assert client.post(api.url_for(Roles, role_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(Roles, role_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_role_put(client): @@ -226,7 +226,7 @@ def test_admin_role_delete(client): def test_admin_role_patch(client): - assert client.patch(api.url_for(Roles, role_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(Roles, role_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_roles_get(client): @@ -240,11 +240,11 @@ def test_admin_role_credentials_get(client): def test_admin_role_credentials_post(client): - assert client.post(api.url_for(RolesList), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 400 + assert client.post(api.url_for(RolesList), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 400 def test_admin_role_credentials_put(client): - assert client.put(api.url_for(RolesList), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(RolesList), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_role_credentials_delete(client): @@ -252,7 +252,7 @@ def test_admin_role_credentials_delete(client): def test_admin_role_credentials_patch(client): - assert client.patch(api.url_for(RolesList), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(RolesList), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_user_roles_get(client): @@ -260,11 +260,11 @@ def test_admin_user_roles_get(client): def test_admin_user_roles_post(client): - assert client.post(api.url_for(UserRolesList, user_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(UserRolesList, user_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_user_roles_put(client): - assert client.put(api.url_for(UserRolesList, user_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(UserRolesList, user_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_user_roles_delete(client): @@ -272,7 +272,7 @@ def test_admin_user_roles_delete(client): def test_admin_user_roles_patch(client): - assert client.patch(api.url_for(UserRolesList, user_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(UserRolesList, user_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_authority_roles_get(client): @@ -280,11 +280,11 @@ def test_admin_authority_roles_get(client): def test_admin_authority_roles_post(client): - assert client.post(api.url_for(AuthorityRolesList, authority_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.post(api.url_for(AuthorityRolesList, authority_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_authority_roles_put(client): - assert client.put(api.url_for(AuthorityRolesList, authority_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.put(api.url_for(AuthorityRolesList, authority_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_authority_roles_delete(client): @@ -292,7 +292,7 @@ def test_admin_authority_roles_delete(client): def test_admin_authority_roles_patch(client): - assert client.patch(api.url_for(AuthorityRolesList, authority_id=1), {}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 + assert client.patch(api.url_for(AuthorityRolesList, authority_id=1), data={}, headers=VALID_ADMIN_HEADER_TOKEN).status_code == 405 def test_admin_roles_crud(client): diff --git a/setup.py b/setup.py index 5e07860b..d5cf38bc 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,8 @@ tests_require = [ 'pyflakes', 'moto', 'nose', - 'pytest' + 'pytest', + 'pytest-flask' ] docs_require = [