# Path: isomorphic/server/template_server.py
# class TemplateServer():
#     def __init__(self):
#         self.started = False
#         self.proc = None
# 
#     def get_cwd(self):
#         pth = os.path.join(
#             os.path.dirname(__file__),
#             '../javascript/dist/'
#         )
#         return pth
# 
#     def get_options(self):
#         options = [
#             'debug={}'.format(settings.DEBUG),
#         ]
#         renderer = getattr(settings, 'DJANGO_ISOMORPHIC_RENDERER', None)
#         if renderer:
#             options.append('renderer={}'.format(renderer))
#         return options
# 
#     def start(self):
#         if self.started:
#             return
#         self.started = True
# 
#         cwd = self.get_cwd()
#         options = self.get_options()
#         self.proc = Popen(['node', 'template-server.js'] + options, cwd=cwd, preexec_fn=os.setsid)
# 
#     def terminate(self):
#         os.killpg(self.proc.pid, signal.SIGTERM)


from django.test import TestCase
from isomorphic.server.template_server import TemplateServer


class TestTemplateServer(TestCase):
    def test_get_cwd(self):
        """
        This is a bad test
        """
        template_server = TemplateServer()
        cwd = template_server.get_cwd()
        self.assertIsNotNone(cwd)

    def test_get_options(self):
        """
        Test get options, including custom renderer
        """

# Path: isomorphic/server/template_server.py
# class TemplateServer():
#     def __init__(self):
#         self.started = False
#         self.proc = None
# 
#     def get_cwd(self):
#         pth = os.path.join(
#             os.path.dirname(__file__),
#             '../javascript/dist/'
#         )
#         return pth
# 
#     def get_options(self):
#         options = [
#             'debug={}'.format(settings.DEBUG),
#         ]
#         renderer = getattr(settings, 'DJANGO_ISOMORPHIC_RENDERER', None)
#         if renderer:
#             options.append('renderer={}'.format(renderer))
#         return options
# 
#     def start(self):
#         if self.started:
#             return
#         self.started = True
# 
#         cwd = self.get_cwd()
#         options = self.get_options()
#         self.proc = Popen(['node', 'template-server.js'] + options, cwd=cwd, preexec_fn=os.setsid)
# 
#     def terminate(self):
#         os.killpg(self.proc.pid, signal.SIGTERM)


# Path: tests/test_template_server.py
from django.test import TestCase
from isomorphic.server.template_server import TemplateServer



class TestTemplateServer(TestCase):
    def test_get_cwd(self):
        """
        This is a bad test
        """
        template_server = TemplateServer()
        cwd = template_server.get_cwd()
        self.assertIsNotNone(cwd)

    def test_get_options(self):
        """
        Test get options, including custom renderer
        """

        template_server = TemplateServer()