def test_append_message_dont_override_older_messages(self): self.request.session.update({"plugins_messages": ["test01"]}) message_system = MessagesSystem(self.request) message_system._append_message("plugins_messages", "test") self.assertEqual(self.request.session.get("plugins_messages"), ["test01", "test"]) message_system._append_message("plugins_messages", ["other_test"]) self.assertEqual(self.request.session.get("plugins_messages"), ["test01", "test", "other_test"])
def test_append_message_can_handle_list(self): message_system = MessagesSystem(self.request) message_system._append_message("plugins_messages", ["test_02"]) self.assertEqual(self.request.session.get("plugins_messages"), ["test_02"])
def test_append_message_can_handle_nested_list(self): message_system = MessagesSystem(self.request) message_system._append_message("items_messages", [[["test"]], "test02"]) self.assertEqual(self.request.session.get("items_messages"), ["test", "test02"])
def test_append_message(self): message_system = MessagesSystem(self.request) message_system._append_message("items_messages", "test") self.assertEqual(self.request.session.get("items_messages"), ["test"])