# Path: src/factory/simple_factory.py
# class App(object):
#     """
# 
#     """
# 
#     def __init__(self, driver: Union[Chrome, Firefox]):
#         """
# 
#         :param driver: browser driver
#         :type driver: object
#         """
#         self.__driver = driver
# 
#     def factory(self, page: str):
#         """
#         The access method which handles pages selection
#         :type page: str
#         """
#         if page == 'Menu':
#             return Menu(self.__driver)
#         elif page == 'Search':
#             return Search(self.__driver)
#         else:
#             raise NotImplemented
# 
# Path: src/utils.py
# def get_selenium_driver(browser_name: str) -> Union[Chrome, Firefox]:
#     """
#     Return the same instance to the Selenium driver.
# 
#     :param browser_name: the name of the browser: chrome or mozilla
#     :type browser_name: str
#     :return: an instance of the required driver.
#     :rtype: Union[Chrome, Mozilla]
#     """
#     if browser_name.upper() == 'CHROME':
#         return SingletonFactory.build(Chrome)
# 
#     elif browser_name.upper() == 'Mozilla':
#         return SingletonFactory.build(Firefox)
# 
#     else:
#         raise NotImplementedError


from unittest import TestCase
from src.factory.simple_factory import App
from src.utils import get_selenium_driver
"""
Description: Test module for module src/factory/simple_factory.py

@author: Paul Bodean
@date: 10/08/2017
"""




class TestSimpleFactory(TestCase):
    """
    Check simple factory functionality
    """
    def setUp(self):
        """
        Driver + factory setup
        :return: driver
        :rtype: object
        """

# Path: src/factory/simple_factory.py
# class App(object):
#     """
# 
#     """
# 
#     def __init__(self, driver: Union[Chrome, Firefox]):
#         """
# 
#         :param driver: browser driver
#         :type driver: object
#         """
#         self.__driver = driver
# 
#     def factory(self, page: str):
#         """
#         The access method which handles pages selection
#         :type page: str
#         """
#         if page == 'Menu':
#             return Menu(self.__driver)
#         elif page == 'Search':
#             return Search(self.__driver)
#         else:
#             raise NotImplemented
# 
# Path: src/utils.py
# def get_selenium_driver(browser_name: str) -> Union[Chrome, Firefox]:
#     """
#     Return the same instance to the Selenium driver.
# 
#     :param browser_name: the name of the browser: chrome or mozilla
#     :type browser_name: str
#     :return: an instance of the required driver.
#     :rtype: Union[Chrome, Mozilla]
#     """
#     if browser_name.upper() == 'CHROME':
#         return SingletonFactory.build(Chrome)
# 
#     elif browser_name.upper() == 'Mozilla':
#         return SingletonFactory.build(Firefox)
# 
#     else:
#         raise NotImplementedError


# Path: tests/factory/test_simple_factory.py
from unittest import TestCase
from src.factory.simple_factory import App
from src.utils import get_selenium_driver

"""
Description: Test module for module src/factory/simple_factory.py

@author: Paul Bodean
@date: 10/08/2017
"""




class TestSimpleFactory(TestCase):
    """
    Check simple factory functionality
    """
    def setUp(self):
        """
        Driver + factory setup
        :return: driver
        :rtype: object
        """

        driver = get_selenium_driver('chrome')