Adding tests to AWS plugin
This commit is contained in:
@ -3,3 +3,7 @@ import unittest
|
||||
|
||||
class LemurTestCase(unittest.TestCase):
|
||||
pass
|
||||
|
||||
|
||||
class LemurPluginTestCase(LemurTestCase):
|
||||
pass
|
||||
|
@ -8,9 +8,7 @@ ADMINS = frozenset([''])
|
||||
|
||||
THREADS_PER_PAGE = 8
|
||||
|
||||
#############
|
||||
## General ##
|
||||
#############
|
||||
# General
|
||||
|
||||
# These will need to be set to `True` if you are developing locally
|
||||
CORS = False
|
||||
@ -28,48 +26,30 @@ LEMUR_ENCRYPTION_KEY = 'jPd2xwxgVGXONqghHNq7/S761sffYSrT3UAgKwgtMxbqa0gmKYCfag==
|
||||
# this is a list of domains as regexes that only admins can issue
|
||||
LEMUR_RESTRICTED_DOMAINS = []
|
||||
|
||||
#################
|
||||
## Mail Server ##
|
||||
#################
|
||||
# Mail Server
|
||||
|
||||
# Lemur currently only supports SES for sending email, this address
|
||||
# needs to be verified
|
||||
LEMUR_EMAIL = ''
|
||||
LEMUR_SECURITY_TEAM_EMAIL = []
|
||||
|
||||
#############
|
||||
## Logging ##
|
||||
#############
|
||||
# Logging
|
||||
|
||||
LOG_LEVEL = "DEBUG"
|
||||
LOG_FILE = "lemur.log"
|
||||
|
||||
|
||||
##############
|
||||
## Database ##
|
||||
##############
|
||||
# Database
|
||||
|
||||
# modify this if you are not using a local database
|
||||
SQLALCHEMY_DATABASE_URI = 'postgresql://lemur:lemur@localhost:5432/lemur'
|
||||
|
||||
|
||||
#########
|
||||
## AWS ##
|
||||
#########
|
||||
# AWS
|
||||
|
||||
# Lemur will need STS assume role access to every destination you want to monitor
|
||||
#AWS_ACCOUNT_MAPPINGS = {
|
||||
# '1111111111': 'myawsacount'
|
||||
#}
|
||||
LEMUR_INSTANCE_PROFILE = 'Lemur'
|
||||
|
||||
## This is useful if you know you only want to monitor one destination
|
||||
#AWS_REGIONS = ['us-east-1']
|
||||
|
||||
#LEMUR_INSTANCE_PROFILE = 'Lemur'
|
||||
|
||||
#############
|
||||
## Issuers ##
|
||||
#############
|
||||
# Issuers
|
||||
|
||||
# These will be dependent on which 3rd party that Lemur is
|
||||
# configured to use.
|
||||
@ -81,8 +61,8 @@ SQLALCHEMY_DATABASE_URI = 'postgresql://lemur:lemur@localhost:5432/lemur'
|
||||
# number of years to issue if not specified
|
||||
#CLOUDCA_DEFAULT_VALIDITY = 2
|
||||
|
||||
#VERISIGN_URL = ''
|
||||
#VERISIGN_PEM_PATH = ''
|
||||
#VERISIGN_FIRST_NAME = ''
|
||||
#VERISIGN_LAST_NAME = ''
|
||||
#VERSIGN_EMAIL = ''
|
||||
VERISIGN_URL = 'http://example.com'
|
||||
VERISIGN_PEM_PATH = '~/'
|
||||
VERISIGN_FIRST_NAME = 'Jim'
|
||||
VERISIGN_LAST_NAME = 'Bob'
|
||||
VERSIGN_EMAIL = 'jim@example.com'
|
||||
|
@ -1,51 +0,0 @@
|
||||
# import boto
|
||||
# from lemur.tests import LemurTestCase
|
||||
|
||||
# from moto import mock_elb, mock_sts
|
||||
|
||||
|
||||
# class ELBTestCase(LemurTestCase):
|
||||
# @mock_sts
|
||||
# @mock_elb
|
||||
# def test_add_listener(self):
|
||||
# from lemur.common.services.aws.elb import create_new_listeners
|
||||
# conn = boto.connect_elb()
|
||||
# zones = ['us-east-1a', 'us-east-1b']
|
||||
# ports = [(80, 8080, 'http')]
|
||||
# conn.create_load_balancer('my-lb', zones, ports)
|
||||
# create_new_listeners('111', 'us-east-1', 'my-lb', listeners=[('443', '80', 'HTTP')])
|
||||
# balancer = conn.get_all_load_balancers()[0]
|
||||
# self.assertEqual(balancer.name, "my-lb")
|
||||
# self.assertEqual(len(balancer.listeners), 2)
|
||||
#
|
||||
# @mock_sts
|
||||
# @mock_elb
|
||||
# def test_update_listener(self):
|
||||
# from lemur.common.services.aws.elb import update_listeners
|
||||
# conn = boto.connect_elb()
|
||||
# zones = ['us-east-1a', 'us-east-1b']
|
||||
# ports = [(80, 8080, 'http')]
|
||||
# conn.create_load_balancer('my-lb', zones, ports)
|
||||
# update_listeners('111', 'us-east-1', 'my-lb', listeners=[('80', '7001', 'http')])
|
||||
# balancer = conn.get_all_load_balancers()[0]
|
||||
# listener = balancer.listeners[0]
|
||||
# self.assertEqual(listener.load_balancer_port, 80)
|
||||
# self.assertEqual(listener.instance_port, 7001)
|
||||
# self.assertEqual(listener.protocol, "HTTP")
|
||||
#
|
||||
# @mock_sts
|
||||
# @mock_elb
|
||||
# def test_set_certificate(self):
|
||||
# from lemur.common.services.aws.elb import attach_certificate
|
||||
# conn = boto.connect_elb()
|
||||
# zones = ['us-east-1a', 'us-east-1b']
|
||||
# ports = [(443, 7001, 'https', 'sslcert')]
|
||||
# conn.create_load_balancer('my-lb', zones, ports)
|
||||
# attach_certificate('1111', 'us-east-1', 'my-lb', 443, 'somecert')
|
||||
# balancer = conn.get_all_load_balancers()[0]
|
||||
# listener = balancer.listeners[0]
|
||||
# self.assertEqual(listener.load_balancer_port, 443)
|
||||
# self.assertEqual(listener.instance_port, 7001)
|
||||
# self.assertEqual(listener.protocol, "HTTPS")
|
||||
# self.assertEqual(listener.ssl_certificate_id, 'somecert')
|
||||
#
|
@ -1,35 +0,0 @@
|
||||
# from lemur.tests import LemurTestCase
|
||||
|
||||
# from lemur.certificates.models import Certificate
|
||||
|
||||
# from moto import mock_iam, mock_sts
|
||||
|
||||
|
||||
# class IAMTestCase(LemurTestCase):
|
||||
# @mock_sts
|
||||
# @mock_iam
|
||||
# def test_get_all_server_certs(self):
|
||||
# from lemur.common.services.aws.iam import upload_cert, get_all_server_certs
|
||||
# cert = Certificate(TEST_CERT)
|
||||
# upload_cert('1111', cert, TEST_KEY)
|
||||
# certs = get_all_server_certs('1111')
|
||||
# self.assertEquals(len(certs), 1)
|
||||
#
|
||||
# @mock_sts
|
||||
# @mock_iam
|
||||
# def test_get_server_cert(self):
|
||||
# from lemur.common.services.aws.iam import upload_cert, get_cert_from_arn
|
||||
# cert = Certificate(TEST_CERT)
|
||||
# upload_cert('1111', cert, TEST_KEY)
|
||||
# body, chain = get_cert_from_arn('arn:aws:iam::123456789012:server-certificate/AHB-dfdsflkj.net-NetflixInc-20140525-20150525')
|
||||
# self.assertTrue(body)
|
||||
#
|
||||
# @mock_sts
|
||||
# @mock_iam
|
||||
# def test_upload_server_cert(self):
|
||||
# from lemur.common.services.aws.iam import upload_cert
|
||||
# cert = Certificate(TEST_CERT)
|
||||
# response = upload_cert('1111', cert, TEST_KEY)
|
||||
# self.assertEquals(response['upload_server_certificate_response']['upload_server_certificate_result']['server_certificate_metadata']['server_certificate_name'], 'AHB-dfdsflkj.net-NetflixInc-20140525-20150525')
|
||||
#
|
||||
#
|
Reference in New Issue
Block a user