示例#1
0
 def test_unicode(self):
     inboxen_flags.FLAGS_TO_TAGS["snowman"] = {
         "title": u"Snowman",
         "str": u"☃",
         "class": "awesome-snowman",
         "inverse": False
     }
     try:
         flag_obj = BitHandler(3, ["snowman"])
         inboxen_flags.render_flags(flag_obj)
     finally:
         del inboxen_flags.FLAGS_TO_TAGS["snowman"]
示例#2
0
    def test_lazy_gettext(self):
        flag_obj = (("new", True),)
        output = inboxen_flags.render_flags(flag_obj)
        self.assertIn(">New<", output)

        translation.activate("sv")
        output = inboxen_flags.render_flags(flag_obj)
        self.assertIn(">Ny<", output)

        # test a non-existing language
        translation.activate("bluhbluhbluh")
        output = inboxen_flags.render_flags(flag_obj)
        self.assertIn(">New<", output)
示例#3
0
    def test_lazy_gettext(self):
        flag_obj = (("new", True), )
        output = inboxen_flags.render_flags(flag_obj)
        self.assertIn(">New<", output)

        translation.activate("sv")
        output = inboxen_flags.render_flags(flag_obj)
        self.assertIn(">Ny<", output)

        # test a non-existing language
        translation.activate("bluhbluhbluh")
        output = inboxen_flags.render_flags(flag_obj)
        self.assertIn(">New<", output)
示例#4
0
    def test_disabled(self):
        flag_obj = BitHandler(5, ["new", "read", "disabled"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Inbox has been disabled", output)
        self.assertIn("label-default", output)
        self.assertEqual(output.count("span"), 2)
示例#5
0
    def test_disabled(self):
        flag_obj = BitHandler(5, ["new", "read", "disabled"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Inbox has been disabled", output)
        self.assertIn("label-default", output)
        self.assertEqual(output.count("span"), 2)
示例#6
0
    def test_disabled(self):
        flag_obj = (("new", True), ("read", False), ("disabled", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Inbox has been disabled", output)
        self.assertIn("label-default", output)
        self.assertEqual(output.count("span"), 2)
示例#7
0
    def test_disabled(self):
        flag_obj = (("new", True), ("read", False), ("disabled", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Inbox has been disabled", output)
        self.assertIn("label-default", output)
        self.assertEqual(output.count("span"), 2)
示例#8
0
    def test_multiple(self):
        flag_obj = (("new", True), ("read", False))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Unread message", output)
        self.assertIn("label-info", output)
        self.assertIn("New messages", output)
        self.assertIn("label-primary", output)
        self.assertEqual(output.count("span"), 4)
示例#9
0
    def test_multiple(self):
        flag_obj = BitHandler(1, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Unread message", output)
        self.assertIn("label-info", output)
        self.assertIn("New messages", output)
        self.assertIn("label-primary", output)
        self.assertEqual(output.count("span"), 4)
示例#10
0
    def test_multiple(self):
        flag_obj = (("new", True), ("read", False))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Unread message", output)
        self.assertIn("label-info", output)
        self.assertIn("New messages", output)
        self.assertIn("label-primary", output)
        self.assertEqual(output.count("span"), 4)
示例#11
0
    def test_multiple(self):
        flag_obj = BitHandler(1, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertIn("Unread message", output)
        self.assertIn("label-info", output)
        self.assertIn("New messages", output)
        self.assertIn("label-primary", output)
        self.assertEqual(output.count("span"), 4)
示例#12
0
    def test_empty(self):
        flag_obj = (("new", False), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
示例#13
0
    def test_invert(self):
        flag_obj = (("new", True), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertNotIn("Unread message", output)
        self.assertNotIn("label-info", output)
示例#14
0
    def test_no_error(self):
        flag_obj = (("new", False), ("read", True), ("somefakeflag", True),
                    ("someother", False))

        inboxen_flags.render_flags(flag_obj)
示例#15
0
    def test_empty(self):
        flag_obj = (("new", False), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
示例#16
0
    def test_invert(self):
        flag_obj = (("new", True), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertNotIn("Unread message", output)
        self.assertNotIn("label-info", output)
示例#17
0
    def test_invert(self):
        flag_obj = BitHandler(3, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertNotIn("Unread message", output)
        self.assertNotIn("label-info", output)
示例#18
0
    def test_empty(self):
        flag_obj = BitHandler(2, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
示例#19
0
    def test_invert(self):
        flag_obj = BitHandler(3, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertNotIn("Unread message", output)
        self.assertNotIn("label-info", output)
示例#20
0
    def test_no_error(self):
        flag_obj = BitHandler(6, ["new", "read", "somefakeflag", "someother"])

        inboxen_flags.render_flags(flag_obj)
示例#21
0
    def test_empty(self):
        flag_obj = BitHandler(2, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output, "&nbsp;")
示例#22
0
    def test_no_error(self):
        flag_obj = (("new", False), ("read", True), ("somefakeflag", True), ("someother", False))

        inboxen_flags.render_flags(flag_obj)
示例#23
0
    def test_no_error(self):
        flag_obj = BitHandler(6, ["new", "read", "somefakeflag", "someother"])

        inboxen_flags.render_flags(flag_obj)