コード例 #1
0
ファイル: test_bunch.py プロジェクト: ermakus/cloudcore
 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())
コード例 #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())
コード例 #3
0
ファイル: cloudpush.py プロジェクト: ermakus/cloudcore
 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)
コード例 #4
0
ファイル: cloudpush.py プロジェクト: ermakus/cloudcore
 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)
コード例 #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")
コード例 #6
0
ファイル: test_bunch.py プロジェクト: ermakus/cloudcore
    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")
コード例 #7
0
 def test_render_cmd(self):
     cmd = _("render " + TEST_PATH)
     self.assertEquals(cmd.execute(), _(TEST_PATH).render())
コード例 #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())
コード例 #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)
コード例 #10
0
ファイル: test_bunch.py プロジェクト: ermakus/cloudcore
 def test_render_cmd(self):
     cmd = _("render " + TEST_PATH)
     self.assertEquals(cmd.execute(), _(TEST_PATH).render())
コード例 #11
0
ファイル: test_bunch.py プロジェクト: ermakus/cloudcore
 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())
コード例 #12
0
ファイル: test_bunch.py プロジェクト: ermakus/cloudcore
 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)