예제 #1
0
    def test_utf8dict(self):
        uk = "foobar"
        d = {u"følelser ær langé": u"ærbadægzaååÆØÅ",
             from_utf8(uk): from_utf8("xuzzybaz")}

        for key, value in http.utf8dict(d.items()).items():
            self.assertIsInstance(key, str)
            self.assertIsInstance(value, str)
예제 #2
0
    def test_utf8dict(self):
        uk = "foobar"
        d = {u"følelser ær langé": u"ærbadægzaååÆØÅ",
             from_utf8(uk): from_utf8("xuzzybaz")}

        for key, value in http.utf8dict(d.items()).items():
            self.assertIsInstance(key, str)
            self.assertIsInstance(value, str)
예제 #3
0
 def test_from_message(self):
     us = u"æØåveéðƒeæ"
     body = {
         "task": mytask.name,
         "id": uuid(),
         "args": [2],
         "kwargs": {
             us: "bar"
         }
     }
     m = Message(None,
                 body=anyjson.serialize(body),
                 backend="foo",
                 content_type="application/json",
                 content_encoding="utf-8")
     tw = TaskRequest.from_message(m, m.decode())
     self.assertIsInstance(tw, Request)
     self.assertEqual(tw.task_name, body["task"])
     self.assertEqual(tw.task_id, body["id"])
     self.assertEqual(tw.args, body["args"])
     us = from_utf8(us)
     if sys.version_info < (2, 6):
         self.assertEqual(tw.kwargs.keys()[0], us)
         self.assertIsInstance(tw.kwargs.keys()[0], str)
     self.assertTrue(tw.logger)
예제 #4
0
 def waitexec(self, argv, path=sys.executable):
     args = " ".join([path] + list(argv))
     argstr = shellsplit(from_utf8(args))
     pipe = Popen(argstr, env=self.env)
     self.info("  %s" % " ".join(argstr))
     retcode = pipe.wait()
     if retcode < 0:
         self.note("* Child was terminated by signal %s" % (-retcode, ))
         return -retcode
     elif retcode > 0:
         self.note("* Child terminated with failure code %s" % (retcode, ))
     return retcode
예제 #5
0
 def waitexec(self, argv, path=sys.executable):
     args = " ".join([path] + list(argv))
     argstr = shellsplit(from_utf8(args))
     pipe = Popen(argstr, env=self.env)
     self.info("  %s" % " ".join(argstr))
     retcode = pipe.wait()
     if retcode < 0:
         self.note("* Child was terminated by signal %s" % (-retcode, ))
         return -retcode
     elif retcode > 0:
         self.note("* Child terminated with failure code %s" % (retcode, ))
     return retcode
예제 #6
0
 def test_from_message(self):
     us = u"æØåveéðƒeæ"
     body = {"task": mytask.name, "id": uuid(),
             "args": [2], "kwargs": {us: "bar"}}
     m = Message(None, body=anyjson.serialize(body), backend="foo",
                       content_type="application/json",
                       content_encoding="utf-8")
     tw = TaskRequest.from_message(m, m.decode())
     self.assertIsInstance(tw, TaskRequest)
     self.assertEqual(tw.task_name, body["task"])
     self.assertEqual(tw.task_id, body["id"])
     self.assertEqual(tw.args, body["args"])
     us = from_utf8(us)
     self.assertEqual(tw.kwargs.keys()[0], us)
     self.assertIsInstance(tw.kwargs.keys()[0], str)
     self.assertTrue(tw.logger)
예제 #7
0
 def test_on_failure_utf8_exception(self):
     self._test_on_failure(Exception(from_utf8(u"Бобры атакуют")))
예제 #8
0
 def test_on_failure_utf8_exception(self):
     self._test_on_failure(Exception(
         from_utf8(u"Бобры атакуют")))