Пример #1
0
    def test_if_id_is_unset(self):
        self.msg.id_ = None

        with self.assertRaisesRegex(
                ValueError,
                r"receipts cannot be generated for id-less messages"):
            mdr_service.compose_receipt(self.msg)
Пример #2
0
    def test_if_id_is_unset(self):
        self.msg.id_ = None

        with self.assertRaisesRegex(
                ValueError,
                r"receipts cannot be generated for id-less messages"):
            mdr_service.compose_receipt(self.msg)
Пример #3
0
    def test_raises_on_receipt(self):
        self.msg.xep0184_received = mdr_xso.Received("foo")

        with self.assertRaisesRegex(
                ValueError,
                r"receipts cannot be generated for receipts"):
            mdr_service.compose_receipt(self.msg)
Пример #4
0
 def test_raises_on_error(self):
     with self.assertRaisesRegex(
             ValueError,
             r"receipts cannot be generated for error messages"):
         mdr_service.compose_receipt(
             aioxmpp.Message(
                 type_=aioxmpp.MessageType.ERROR
             )
         )
Пример #5
0
    def test_receipt_refers_to_message_id(self):
        msg = mdr_service.compose_receipt(self.msg)

        self.assertIsInstance(
            msg.xep0184_received,
            mdr_xso.Received,
        )

        self.assertEqual(
            msg.xep0184_received.message_id,
            self.msg.id_,
        )
Пример #6
0
    def test_receipt_refers_to_message_id(self):
        msg = mdr_service.compose_receipt(self.msg)

        self.assertIsInstance(
            msg.xep0184_received,
            mdr_xso.Received,
        )

        self.assertEqual(
            msg.xep0184_received.message_id,
            self.msg.id_,
        )
Пример #7
0
 def test_strips_body(self):
     msg = mdr_service.compose_receipt(self.msg)
     self.assertFalse(msg.body)
Пример #8
0
    def test_raises_on_receipt(self):
        self.msg.xep0184_received = mdr_xso.Received("foo")

        with self.assertRaisesRegex(
                ValueError, r"receipts cannot be generated for receipts"):
            mdr_service.compose_receipt(self.msg)
Пример #9
0
 def test_raises_on_error(self):
     with self.assertRaisesRegex(
             ValueError,
             r"receipts cannot be generated for error messages"):
         mdr_service.compose_receipt(
             aioxmpp.Message(type_=aioxmpp.MessageType.ERROR))
Пример #10
0
 def test_preserves_type(self):
     msg = mdr_service.compose_receipt(self.msg)
     self.assertEqual(msg.type_, self.msg.type_)
Пример #11
0
 def test_sends_to_bare_jid(self):
     msg = mdr_service.compose_receipt(self.msg)
     self.assertEqual(msg.to, self.msg.from_.bare())
Пример #12
0
 def test_strips_body(self):
     msg = mdr_service.compose_receipt(self.msg)
     self.assertFalse(msg.body)
Пример #13
0
 def test_preserves_type(self):
     msg = mdr_service.compose_receipt(self.msg)
     self.assertEqual(msg.type_, self.msg.type_)
Пример #14
0
 def test_sends_to_bare_jid(self):
     msg = mdr_service.compose_receipt(self.msg)
     self.assertEqual(
         msg.to,
         self.msg.from_.bare()
     )