# Path: rpaas/ssl_plugins/le.py
# class LE(BaseSSLPlugin):
# class ConfigNamespace(object):
#     def __init__(self, domain, email, instance_name, consul_manager=None):
#     def upload_csr(self, csr=None):
#     def download_crt(self, id=None):
#     def revoke(self):
#     def __init__(self, email, domains):
# def _main(domains=[], email=None, instance_name="", consul_manager=None):
# def _revoke(rawkey, rawcert):


import unittest
import mock
from rpaas.ssl_plugins import le
# Copyright 2016 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.




def patch_main(args):
    return "crt", "chain", "key"


class LETest(unittest.TestCase):

    def setUp(self):
        self.patcher = mock.patch('rpaas.ssl_plugins.le._main', patch_main)
        self.patcher.start()
        self.instance = le.LE(['domain'], 'email@corp', ['host1'])

    def tearDown(self):
        self.patcher.stop()

    def test_upload_csr(self):
        self.assertEqual(self.instance.upload_csr('asdasdasdasdadasd'), None)

    def test_download_crt(self):

# Path: rpaas/ssl_plugins/le.py
# class LE(BaseSSLPlugin):
# class ConfigNamespace(object):
#     def __init__(self, domain, email, instance_name, consul_manager=None):
#     def upload_csr(self, csr=None):
#     def download_crt(self, id=None):
#     def revoke(self):
#     def __init__(self, email, domains):
# def _main(domains=[], email=None, instance_name="", consul_manager=None):
# def _revoke(rawkey, rawcert):


# Path: tests/test_ssl_le.py
import unittest
import mock
from rpaas.ssl_plugins import le

# Copyright 2016 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.




def patch_main(args):
    return "crt", "chain", "key"


class LETest(unittest.TestCase):

    def setUp(self):
        self.patcher = mock.patch('rpaas.ssl_plugins.le._main', patch_main)
        self.patcher.start()
        self.instance = le.LE(['domain'], 'email@corp', ['host1'])

    def tearDown(self):
        self.patcher.stop()

    def test_upload_csr(self):
        self.assertEqual(self.instance.upload_csr('asdasdasdasdadasd'), None)

    def test_download_crt(self):

        with mock.patch.object(le.LE, 'download_crt', return_value=None) as mock_method: