Beispiel #1
0
 def test_execute(self):
     empty = _(TEST_PATH + "/empty")
     ls = _("ls %s" % empty.path)
     self.assertEquals(ls.kind, "ls")
     self.assertEquals(ls.bunch, empty.path)
     res = ls.execute()
     self.assertEquals(res, empty.ls())
Beispiel #2
0
 def test_execute(self):
     empty = _(TEST_PATH + "/empty")
     ls = _("ls %s" % empty.path)
     self.assertEquals(ls.kind, "ls")
     self.assertEquals(ls.bunch, empty.path)
     res = ls.execute()
     self.assertEquals(res, empty.ls())
Beispiel #3
0
 def dataReceived(self, body):
     path = '/'
     self.subscribe(path)
     res = _(body).execute()
     print "EXEC: %s => %s" % (body, res)
     if isinstance(res, Bunch): res = res.render(level=1)
     result = self.factory.mqm.send_message(self, path, res)
Beispiel #4
0
 def dataReceived(self, body):
     path = "/"
     self.subscribe(path)
     res = _(body).execute()
     print "EXEC: %s => %s" % (body, res)
     if isinstance(res, Bunch):
         res = res.render(level=1)
     result = self.factory.mqm.send_message(self, path, res)
Beispiel #5
0
    def test_subscribe(self):

        gotcha = [None, None]

        def handler(who, event):
            gotcha[0] = who
            gotcha[1] = event

        origin = _(TEST_PATH + "/origin")
        origin.subscribe(handler)
        origin.notify("Event")

        self.assertEquals(gotcha[0], origin)
        self.assertEquals(gotcha[1], "Event")

        origin.unsubscribe(handler)
        origin.notify("Nope")
        self.assertEquals(gotcha[1], "Event")
Beispiel #6
0
    def test_subscribe(self):

        gotcha = [None, None]

        def handler(who, event):
            gotcha[0] = who
            gotcha[1] = event

        origin = _(TEST_PATH + "/origin")
        origin.subscribe(handler)
        origin.notify("Event")

        self.assertEquals(gotcha[0], origin)
        self.assertEquals(gotcha[1], "Event")

        origin.unsubscribe(handler)
        origin.notify("Nope")
        self.assertEquals(gotcha[1], "Event")
Beispiel #7
0
 def test_render_cmd(self):
     cmd = _("render " + TEST_PATH)
     self.assertEquals(cmd.execute(), _(TEST_PATH).render())
Beispiel #8
0
 def test_type(self):
     txt = _(TEST_PATH + "/txt", "test", "<html>\t</html>\r\n")
     self.assertEquals(txt.mimetype(), "text/html")
     self.assertFalse(txt.is_binary())
     bin = _(TEST_PATH + "/bin", "test", "BIN\01\02\03\04")
     self.assertTrue(bin.is_binary())
Beispiel #9
0
 def test_ls(self):
     empty = _(TEST_PATH + "/empty", "test", "Content")
     self.assertEquals(empty.ls(), empty.name() + ": Content")
     _(ROOT_SYS + "templates/menu.template")
     listing = _(ROOT_SYS + "templates").ls(level=2)
     self.assertTrue("menu.template" in listing)
Beispiel #10
0
 def test_render_cmd(self):
     cmd = _("render " + TEST_PATH)
     self.assertEquals(cmd.execute(), _(TEST_PATH).render())
Beispiel #11
0
 def test_type(self):
     txt = _(TEST_PATH + "/txt", "test", "<html>\t</html>\r\n")
     self.assertEquals(txt.mimetype(), "text/html")
     self.assertFalse(txt.is_binary())
     bin = _(TEST_PATH + "/bin", "test", "BIN\01\02\03\04")
     self.assertTrue(bin.is_binary())
Beispiel #12
0
 def test_ls(self):
     empty = _(TEST_PATH + "/empty", "test", "Content")
     self.assertEquals(empty.ls(), empty.name() + ": Content")
     _(ROOT_SYS + "templates/menu.template")
     listing = _(ROOT_SYS + "templates").ls(level=2)
     self.assertTrue("menu.template" in listing)