Пример #1
0
    def testDeleteConversationWithoutOwner(self):
        c, msg = User.add_new_conversation(self.u1.username_norm, self.u2.username_norm,
            title_plain_text,
            content_plain_text)

        m = Conversation.add_new_message(self.u2.username_norm,
            content_plain_text2, conv_key=c.key)

#        c.put()

        Conversation.delete_conversation(self.u2.username_norm, key=c.key)

        conv = c.key.get()
        self.assertIsNotNone(conv, "Conversation is None")
        self.assertEqual(conv.deleted_for, self.u2.username_norm,
            "Conversation not deleted for %s" % self.u2.username_norm)

        for m in conv.messages:
            self.assertEqual(m.deleted_for, self.u2.username_norm,
                "Message not deleted for %s" % self.u2.username_norm)
Пример #2
0
    def testDeleteConversationWithOwner(self):
        c, msg = User.add_new_conversation(self.u1.username_norm, self.u2.username_norm,
            title_plain_text,
            content_plain_text)

        m = Conversation.add_new_message(self.u2.username_norm,
            content_plain_text2, conv_key=c.key)

        message_keys = deepcopy(c.messages_list)

#        c.put()

        Conversation.delete_conversation(self.u1.username_norm, key=c.key)

        conv = c.key.get()
        self.assertIsNone(conv, "Conversation is not None")

        for k in message_keys:
            msg = k.get()
            self.assertIsNone(msg, "Message is not None")
Пример #3
0
    def testDeleteConversationWithOwner(self):
        c = User.add_new_conversation(self.u1.username_norm,
                                      self.u2.username_norm, title_plain_text,
                                      content_plain_text)

        m = Conversation.add_new_message(self.u2.username_norm,
                                         content_plain_text2,
                                         conv_key=c.key)

        message_keys = deepcopy(c.messages_list)

        c.put()

        Conversation.delete_conversation(self.u1.username_norm, key=c.key)

        conv = c.key.get()
        self.assertIsNone(conv, "Conversation is not None")

        for k in message_keys:
            msg = k.get()
            self.assertIsNone(msg, "Message is not None")
Пример #4
0
    def testDeleteConversationWithoutOwner(self):
        c = User.add_new_conversation(self.u1.username_norm,
                                      self.u2.username_norm, title_plain_text,
                                      content_plain_text)

        m = Conversation.add_new_message(self.u2.username_norm,
                                         content_plain_text2,
                                         conv_key=c.key)

        c.put()

        Conversation.delete_conversation(self.u2.username_norm, key=c.key)

        conv = c.key.get()
        self.assertIsNotNone(conv, "Conversation is None")
        self.assertEqual(
            conv.deleted_for, self.u2.username_norm,
            "Conversation not deleted for %s" % self.u2.username_norm)

        for m in conv.messages:
            self.assertEqual(
                m.deleted_for, self.u2.username_norm,
                "Message not deleted for %s" % self.u2.username_norm)