Beispiel #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"]
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #12
0
    def test_empty(self):
        flag_obj = (("new", False), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
Beispiel #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)
Beispiel #14
0
    def test_no_error(self):
        flag_obj = (("new", False), ("read", True), ("somefakeflag", True),
                    ("someother", False))

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

        self.assertEqual(output.strip(), "&nbsp;")
Beispiel #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)
Beispiel #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)
Beispiel #18
0
    def test_empty(self):
        flag_obj = BitHandler(2, ["new", "read"])
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
Beispiel #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)
Beispiel #20
0
    def test_no_error(self):
        flag_obj = BitHandler(6, ["new", "read", "somefakeflag", "someother"])

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

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

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

        inboxen_flags.render_flags(flag_obj)