def test_should_get_connection_to_amazon_cloudfront_using_boto(self): with app.test_request_context(): CloudFrontConnection = self.mocker.replace('boto.cloudfront.CloudFrontConnection') CloudFrontConnection(aws_access_key_id=app.config['AWS_ACCESS_KEY_ID'], aws_secret_access_key=app.config['AWS_SECRET_ACCESS_KEY']) self.mocker.result('connected') self.mocker.replay() from awsmanager.util import ConnectionManager connection = ConnectionManager.get_cloudfront_connection() assert_equals('connected', connection) self.mocker.verify()
def purge_paths(): distribution_id = request.form["distribution"] paths = [p.strip() for p in request.form["paths"].split("\n")] connection = ConnectionManager.get_cloudfront_connection() batch = connection.create_invalidation_request(distribution_id, paths) return render_template("invalidation_sent.html", batch=batch)
def show_purge_form(): connection = ConnectionManager.get_cloudfront_connection() distributions = connection.get_all_distributions() return render_template("purge_form.html", distributions=distributions)
def purge_paths(): distribution_id = request.form['distribution'] paths = [p.strip() for p in request.form['paths'].split('\n')] connection = ConnectionManager.get_cloudfront_connection() batch = connection.create_invalidation_request(distribution_id, paths) return render_template("invalidation_sent.html", batch=batch)