# Path: nbdiff/server/database/nbdiffModel.py
# class nbdiffModel(Base):
#     __tablename__ = 'nbdiffResult'
#     id = Column(Integer, primary_key=True)
#     notebook = Column('notebook', Binary)
# 
#     def __init__(self, notebook):
#         self.notebook = notebook
# 
#     def __repr__(self):
#         return '<Notebook %r>' % (self.notebook)


import os
import unittest
import nbdiff.server.command.AboutUsCommand as aucmd
import nbdiff.server.command.ComparisonCommand as ccmd
import nbdiff.server.command.ContactUsCommand as cucmd
import nbdiff.server.command.DiffCommand as dcmd
import nbdiff.server.command.DiffURLCommand as ducmd
import nbdiff.server.command.FaqCommand as fcmd
import nbdiff.server.command.MergeCommand as mcmd
import nbdiff.server.command.MergeURLCommand as mucmd
import nbdiff.server.command.NotebookRequestCommand as nrcmd
import nbdiff.server.command.ResourceRequestCommand as rrcmd
import nbdiff.server.command.SaveNotebookCommand as sncmd
import nbdiff.server.command.UploadCommand as ucmd
import nbdiff.server.remote_server as rs
import nbdiff.server.database as db
import bitarray
from pretend import stub
from nbdiff.server.database.nbdiffModel import nbdiffModel

class FaqCommandTest(unittest.TestCase):

    def test_newInstance(self):
        classname = "nbdiff.server.command.FaqCommand"
        assert isinstance(
            rs.get_class(classname).newInstance(),
            fcmd.FaqCommand
        )

    def test_process(self):
        fcmd.render_template = mock_render_template
        template = fcmd.FaqCommand().process(None, None, None)
        assert template == "faq.html"


class ComparisonCommandTest(unittest.TestCase):

    def test_newInstance(self):
        classname = "nbdiff.server.command.ComparisonCommand"
        assert isinstance(
            rs.get_class(classname).newInstance(),
            ccmd.ComparisonCommand
        )

    def test_process(self):
        ccmd.render_template = mock_render_template
        session = db.db_session()
        ba = bitarray.bitarray()
        ba.fromstring("test")

# Path: nbdiff/server/database/nbdiffModel.py
# class nbdiffModel(Base):
#     __tablename__ = 'nbdiffResult'
#     id = Column(Integer, primary_key=True)
#     notebook = Column('notebook', Binary)
# 
#     def __init__(self, notebook):
#         self.notebook = notebook
# 
#     def __repr__(self):
#         return '<Notebook %r>' % (self.notebook)


# Path: tests/test_remote_server.py
import os
import unittest
import nbdiff.server.command.AboutUsCommand as aucmd
import nbdiff.server.command.ComparisonCommand as ccmd
import nbdiff.server.command.ContactUsCommand as cucmd
import nbdiff.server.command.DiffCommand as dcmd
import nbdiff.server.command.DiffURLCommand as ducmd
import nbdiff.server.command.FaqCommand as fcmd
import nbdiff.server.command.MergeCommand as mcmd
import nbdiff.server.command.MergeURLCommand as mucmd
import nbdiff.server.command.NotebookRequestCommand as nrcmd
import nbdiff.server.command.ResourceRequestCommand as rrcmd
import nbdiff.server.command.SaveNotebookCommand as sncmd
import nbdiff.server.command.UploadCommand as ucmd
import nbdiff.server.remote_server as rs
import nbdiff.server.database as db
import bitarray
from pretend import stub
from nbdiff.server.database.nbdiffModel import nbdiffModel


class FaqCommandTest(unittest.TestCase):

    def test_newInstance(self):
        classname = "nbdiff.server.command.FaqCommand"
        assert isinstance(
            rs.get_class(classname).newInstance(),
            fcmd.FaqCommand
        )

    def test_process(self):
        fcmd.render_template = mock_render_template
        template = fcmd.FaqCommand().process(None, None, None)
        assert template == "faq.html"


class ComparisonCommandTest(unittest.TestCase):

    def test_newInstance(self):
        classname = "nbdiff.server.command.ComparisonCommand"
        assert isinstance(
            rs.get_class(classname).newInstance(),
            ccmd.ComparisonCommand
        )

    def test_process(self):
        ccmd.render_template = mock_render_template
        session = db.db_session()
        ba = bitarray.bitarray()
        ba.fromstring("test")

        obj = nbdiffModel(ba.to01())