コード例 #1
0
class Test_Noteboard(unittest.TestCase):
    def setUp(self):
        try:
            self._my_class=Noteboard()
        except Exception as excp:
            pass
    
    def test_noteboard_class_instantiates(self):
        self.assertIsInstance(self._my_class, Noteboard, "Could not instantiate Noteboard")
    
    def test_noteboard_returns_page(self):
        code, error=tidylib.tidy_document(self._my_class.noteboard(), options={'show-errors':1,'show-warnings':0})
        self.assertFalse(error, "/notes/noteboard does not return valid html page")

    def test_get_notes(self):
        result=self._my_class.get_notes()
        self.assertIsInstance( result, type([]), "/notes/get_notes does not return array")

    def test_post_note(self):
        code, error=tidylib.tidy_document(self._my_class.post_note(**{'author':'test', 'message':'test'}), options={'show-errors':1,'show-warnings':0})
        self.assertFalse(error, "/notes/post_note does not return valid html page")
コード例 #2
0
class Test_Noteboard(unittest.TestCase):
    def setUp(self):
        try:
            self._my_class = Noteboard()
        except Exception as excp:
            pass

    def test_noteboard_class_instantiates(self):
        self.assertIsInstance(self._my_class, Noteboard,
                              "Could not instantiate Noteboard")

    def test_noteboard_returns_page(self):
        code, error = tidylib.tidy_document(self._my_class.noteboard(),
                                            options={
                                                "show-errors": 1,
                                                "show-warnings": 0
                                            })
        self.assertFalse(error,
                         "/notes/noteboard does not return valid html page")

    def test_get_notes(self):
        result = self._my_class.get_notes()
        self.assertIsInstance(result, type([]),
                              "/notes/get_notes does not return array")

    def test_post_note(self):
        code, error = tidylib.tidy_document(
            self._my_class.post_note(**{
                "author": "test",
                "message": "test"
            }),
            options={
                "show-errors": 1,
                "show-warnings": 0
            },
        )
        self.assertFalse(error,
                         "/notes/post_note does not return valid html page")
コード例 #3
0
 def setUp(self):
     try:
         self._my_class=Noteboard()
     except Exception as excp:
         pass
コード例 #4
0
from inventoryserver.server import SpecialOrders

# cherrypy.config.update({'environment': 'embedded'})

if cherrypy.__version__.startswith("3.0") and cherrypy.engine.state == 0:
    cherrypy.engine.start(blocking=False)
    atexit.register(cherrypy.engine.stop)


class Root(object):
    def index(self):
        return "Hello World!"

    index.exposed = True


root = InventoryServer()
root.admin = Admin()
root.staffing = Staffing()
root.notes = Noteboard()
root.register = Register()
root.specialorder = SpecialOrders()

cherrypy_local_config_file = configuration.get("cherrypy_local_config_file")
application = cherrypy.Application(
    root, script_name=None, config=cherrypy_local_config_file
)

if __name__ == "__main__":
    cherrypy.quickstart(root, "/", cherrypy_local_config_file)
コード例 #5
0
 def setUp(self):
     try:
         self._my_class = Noteboard()
     except Exception as excp:
         pass