forked from wxWidgets/Phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_lib_pubsub_notify3.py
57 lines (39 loc) · 1.64 KB
/
test_lib_pubsub_notify3.py
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
50
51
52
53
54
55
56
57
"""
:copyright: Copyright 2006-2009 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE.txt for details.
"""
import unittest
from unittests import wtc
from difflib import ndiff, unified_diff, context_diff
#---------------------------------------------------------------------------
class lib_pubsub_NotifyFlagChanges(wtc.PubsubTestCase):
def testFlagChanges(self):
savedFlags = self.pub.getNotificationFlags()
self.pub.setNotificationFlags(all=True, sendMessage=False, deadListener=False)
flags = self.pub.getNotificationFlags()
assert not flags['sendMessage']
assert not flags['deadListener']
assert flags['newTopic']
assert flags['delTopic']
assert flags['subscribe']
assert flags['unsubscribe']
self.pub.setNotificationFlags(subscribe=False, deadListener=True)
flags = self.pub.getNotificationFlags()
assert not flags['sendMessage']
assert not flags['subscribe']
assert flags['newTopic']
assert flags['delTopic']
assert flags['deadListener']
assert flags['unsubscribe']
self.pub.setNotificationFlags(all=False, subscribe=True, unsubscribe=True)
flags = self.pub.getNotificationFlags()
assert not flags['sendMessage']
assert not flags['deadListener']
assert not flags['newTopic']
assert not flags['delTopic']
assert flags['subscribe']
assert flags['unsubscribe']
self.pub.setNotificationFlags(** savedFlags)
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()