File: test_mam_archivable.py

package info (click to toggle)
slidge 0.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,524 kB
  • sloc: python: 22,079; xml: 525; sh: 57; javascript: 27; makefile: 14
file content (49 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from slixmpp import register_stanza_plugin, Message
from slixmpp.plugins.xep_0333.stanza import Displayed
from slixmpp.plugins.xep_0334 import Store, NoStore, NoPermanentStore
from slixmpp.plugins.xep_0424.stanza import Retract

from slidge.group.archive import archivable
from slixmpp.test import SlixTest

class TestArchivable(SlixTest):
    def setUp(self):
        register_stanza_plugin(Message, Displayed)
        register_stanza_plugin(Message, Retract)
        register_stanza_plugin(Message, Store)
        register_stanza_plugin(Message, NoStore)
        register_stanza_plugin(Message, NoPermanentStore)

    def test_marker(self):
        msg = Message()
        assert not archivable(msg)
        msg.enable("displayed")
        assert archivable(msg)

    def test_retract(self):
        msg = Message()
        assert not archivable(msg)
        msg.enable("retract")
        assert archivable(msg)

    def test_hint_store(self):
        msg = Message()
        assert not archivable(msg)
        msg.enable("store")
        assert archivable(msg)

    def test_hint_no_store(self):
        msg = Message()
        msg["body"] = "boobobo"
        assert archivable(msg)

        msg.enable("no-store")
        assert not archivable(msg)

    def test_hint_no_permanent_store(self):
        msg = Message()
        msg["body"] = "boobobo"
        assert archivable(msg)

        msg.enable("no-permanent-store")
        assert not archivable(msg)