Пример #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)