# Path: app/views.py
# def get_gates():
# def new_gate():
# def edit_holidays():
# def is_environment(environment, holiday):
# def error_page(error):


import sys
import unittest
from mock import mock
from app import views
                 'environments': ['live']}]


class MongoMockWithTwoHolidays:
    @staticmethod
    def get_future_holidays():
        return [{'date': '2020-12-25',
                 'reason': 'Talfest',
                 'environments': ['develop', 'live']},
                {'date': '2037-06-05',
                 'reason': 'Bergfest',
                 'environments': ['develop']}]


class TestViews(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.maxDiff = None

    @mock.patch('flask.templating.render_template')
    def test_view_edit_holidays_calls_mock(self, template_mock):
        views.blueprint.mongo = MongoMock()
        views.render_template = template_mock
        views.edit_holidays()
        self.assertEqual(1, len(template_mock.mock_calls))

    @mock.patch('flask.templating.render_template')
    def test_view_edit_holidays_calls_renders_bergfest(self, template_mock):
        views.blueprint.mongo = MongoMock()
        views.render_template = template_mock

# Path: app/views.py
# def get_gates():
# def new_gate():
# def edit_holidays():
# def is_environment(environment, holiday):
# def error_page(error):


# Path: tests/test_views.py
import sys
import unittest
from mock import mock
from app import views

                 'environments': ['live']}]


class MongoMockWithTwoHolidays:
    @staticmethod
    def get_future_holidays():
        return [{'date': '2020-12-25',
                 'reason': 'Talfest',
                 'environments': ['develop', 'live']},
                {'date': '2037-06-05',
                 'reason': 'Bergfest',
                 'environments': ['develop']}]


class TestViews(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.maxDiff = None

    @mock.patch('flask.templating.render_template')
    def test_view_edit_holidays_calls_mock(self, template_mock):
        views.blueprint.mongo = MongoMock()
        views.render_template = template_mock
        views.edit_holidays()
        self.assertEqual(1, len(template_mock.mock_calls))

    @mock.patch('flask.templating.render_template')
    def test_view_edit_holidays_calls_renders_bergfest(self, template_mock):
        views.blueprint.mongo = MongoMock()
        views.render_template = template_mock

        views.edit_holidays()