コード例 #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
ファイル: test_templatetags.py プロジェクト: Inboxen/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: 3nprob/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: 3nprob/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: Inboxen/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: 3nprob/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: Inboxen/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: 3nprob/Inboxen
    def test_empty(self):
        flag_obj = (("new", False), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
コード例 #13
0
ファイル: test_templatetags.py プロジェクト: 3nprob/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: 3nprob/Inboxen
    def test_no_error(self):
        flag_obj = (("new", False), ("read", True), ("somefakeflag", True),
                    ("someother", False))

        inboxen_flags.render_flags(flag_obj)
コード例 #15
0
ファイル: test_templatetags.py プロジェクト: Inboxen/Inboxen
    def test_empty(self):
        flag_obj = (("new", False), ("read", True))
        output = inboxen_flags.render_flags(flag_obj)

        self.assertEqual(output.strip(), "&nbsp;")
コード例 #16
0
ファイル: test_templatetags.py プロジェクト: Inboxen/Inboxen
    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
ファイル: test_templatetags.py プロジェクト: Inboxen/Inboxen
    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)