# Path: app/routes/api.py
# def check_email_config():
#     """
#     @return: False if there are missing configuration parameters for emailing
#     """
#     passed = True
#     required = ['MAIL_USERNAME', 'MAIL_PASSWORD', 'MAIL_SERVER', 'MAIL_PORT']
#     errors = []
# 
#     for req in required:
#         if req not in app.config:
#             errors.append("Emailing param {} was not configured.".format(req))
# 
#     for error in errors:
#         app.logger.error(error)
#         passed = False
# 
#     return passed, errors


from .base_test import BaseTestCase
from app.routes.api import check_email_config
'''
Goal: test functions in routes/api.py
'''


class RoutesApiTests(BaseTestCase):

    def test_check_email_config(self):
        """ Fail when nothing set """
        errors = [
            'Emailing param MAIL_USERNAME was not configured.',
            'Emailing param MAIL_PASSWORD was not configured.',
            'Emailing param MAIL_SERVER was not configured.',
            'Emailing param MAIL_PORT was not configured.']

# Path: app/routes/api.py
# def check_email_config():
#     """
#     @return: False if there are missing configuration parameters for emailing
#     """
#     passed = True
#     required = ['MAIL_USERNAME', 'MAIL_PASSWORD', 'MAIL_SERVER', 'MAIL_PORT']
#     errors = []
# 
#     for req in required:
#         if req not in app.config:
#             errors.append("Emailing param {} was not configured.".format(req))
# 
#     for error in errors:
#         app.logger.error(error)
#         passed = False
# 
#     return passed, errors


# Path: tests/test_routes_api.py
from .base_test import BaseTestCase
from app.routes.api import check_email_config

'''
Goal: test functions in routes/api.py
'''


class RoutesApiTests(BaseTestCase):

    def test_check_email_config(self):
        """ Fail when nothing set """
        errors = [
            'Emailing param MAIL_USERNAME was not configured.',
            'Emailing param MAIL_PASSWORD was not configured.',
            'Emailing param MAIL_SERVER was not configured.',
            'Emailing param MAIL_PORT was not configured.']

        passed, actual_errors = check_email_config()