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"]
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)
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)
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)
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)
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)
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)
def test_empty(self): flag_obj = (("new", False), ("read", True)) output = inboxen_flags.render_flags(flag_obj) self.assertEqual(output.strip(), " ")
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)
def test_no_error(self): flag_obj = (("new", False), ("read", True), ("somefakeflag", True), ("someother", False)) inboxen_flags.render_flags(flag_obj)
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)
def test_empty(self): flag_obj = BitHandler(2, ["new", "read"]) output = inboxen_flags.render_flags(flag_obj) self.assertEqual(output.strip(), " ")
def test_no_error(self): flag_obj = BitHandler(6, ["new", "read", "somefakeflag", "someother"]) inboxen_flags.render_flags(flag_obj)
def test_empty(self): flag_obj = BitHandler(2, ["new", "read"]) output = inboxen_flags.render_flags(flag_obj) self.assertEqual(output, " ")