annotate idavoll/test/test_storage.py @ 123:8f99b4f7aea2

Add tests for all Node methods.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 12 Apr 2005 12:28:07 +0000
parents bc872c33e88c
children fe8cb99363ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
1 from twisted.trial import unittest
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
2 from twisted.trial.assertions import *
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
3 from twisted.words.protocols.jabber import jid
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
4 from twisted.internet import defer
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
6 from idavoll import storage
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
7
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
8 OWNER = jid.JID('owner@example.com')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
9 SUBSCRIBER = jid.JID('subscriber@example.com/Home')
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
10 SUBSCRIBER_NEW = jid.JID('new@example.com/Home')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
11 SUBSCRIBER_TO_BE_DELETED = jid.JID('to_be_deleted@example.com/Home')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
12 SUBSCRIBER_PENDING = jid.JID('pending@example.com/Home')
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
13
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
14 class StorageTests:
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
15
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
16 def _assignTestNode(self, node):
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
17 self.node = node
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
18
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
19 def setUpClass(self):
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
20 d = self.s.get_node('pre-existing')
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
21 d.addCallback(self._assignTestNode)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
22 return d
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
23
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
24 def testGetNode(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
25 return self.s.get_node('pre-existing')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
26
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
27 def testGetNonExistingNode(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
28 d = self.s.get_node('non-existing')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
29 assertFailure(d, storage.NodeNotFound)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
30 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
31
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
32 def testGetNodeIDs(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
33 def cb(node_ids):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
34 assertIn('pre-existing', node_ids)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
35 assertNotIn('non-existing', node_ids)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
36
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
37 return self.s.get_node_ids().addCallback(cb)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
38
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
39 def testCreateExistingNode(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
40 d = self.s.create_node('pre-existing', OWNER)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
41 assertFailure(d, storage.NodeExists)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
42 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
43
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
44 def testCreateNode(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
45 def cb(void):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
46 d = self.s.get_node('new 1')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
47 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
48
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
49 d = self.s.create_node('new 1', OWNER)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
50 d.addCallback(cb)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
51 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
52
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
53 def testDeleteNonExistingNode(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
54 d = self.s.delete_node('non-existing')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
55 assertFailure(d, storage.NodeNotFound)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
56 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
57
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
58 def testDeleteNode(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
59 def cb(void):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
60 d = self.s.get_node('to-be-deleted')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
61 assertFailure(d, storage.NodeNotFound)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
62 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
63
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
64 d = self.s.delete_node('to-be-deleted')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
65 d.addCallback(cb)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
66 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
67
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
68 def testGetAffiliations(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
69 def cb(affiliations):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
70 assertIn(('pre-existing', 'owner'), affiliations)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
71
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
72 d = self.s.get_affiliations(OWNER)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
73 d.addCallback(cb)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
74 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
75
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
76 def testGetSubscriptions(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
77 def cb(subscriptions):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
78 assertIn(('pre-existing', SUBSCRIBER, 'subscribed'), subscriptions)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
79
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
80 d = self.s.get_subscriptions(SUBSCRIBER)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
81 d.addCallback(cb)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
82 return d
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
83
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
84 # Node tests
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
85
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
86 def testGetType(self):
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
87 assertEqual(self.node.get_type(), 'leaf')
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
88
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
89 def testGetConfiguration(self):
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
90 config = self.node.get_configuration()
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
91 assertIn('pubsub#persist_items', config.iterkeys())
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
92 assertIn('pubsub#deliver_payloads', config.iterkeys())
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
93 assertEqual(config['pubsub#persist_items'], True)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
94 assertEqual(config['pubsub#deliver_payloads'], True)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
95
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
96 def testSetConfiguration(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
97 def get_config(node):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
98 d = node.set_configuration({'pubsub#persist_items': False})
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
99 d.addCallback(lambda _: node)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
100 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
101
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
102 def check_object_config(node):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
103 config = node.get_configuration()
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
104 assertEqual(config['pubsub#persist_items'], False)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
105
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
106 def get_node(void):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
107 return self.s.get_node('to-be-reconfigured')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
108
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
109 def check_storage_config(node):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
110 config = node.get_configuration()
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
111 assertEqual(config['pubsub#persist_items'], False)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
112
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
113 d = self.s.get_node('to-be-reconfigured')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
114 d.addCallback(get_config)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
115 d.addCallback(check_object_config)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
116 d.addCallback(get_node)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
117 d.addCallback(check_storage_config)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
118 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
119
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
120 def testGetMetaData(self):
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
121 meta_data = self.node.get_meta_data()
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
122 for key, value in self.node.get_configuration().iteritems():
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
123 assertIn(key, meta_data.iterkeys())
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
124 assertEqual(value, meta_data[key])
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
125 assertIn('pubsub#node_type', meta_data.iterkeys())
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
126 assertEqual(meta_data['pubsub#node_type'], 'leaf')
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
127
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
128 def testGetAffiliation(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
129 def cb(affiliation):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
130 assertEqual(affiliation, 'owner')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
131
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
132 d = self.node.get_affiliation(OWNER)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
133 d.addCallback(cb)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
134 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
135
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
136 def testGetNonExistingAffiliation(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
137 def cb(affiliation):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
138 assertEqual(affiliation, None)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
139
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
140 d = self.node.get_affiliation(SUBSCRIBER)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
141 d.addCallback(cb)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
142 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
143
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
144 def testAddSubscription(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
145 def cb1(void):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
146 return self.node.get_subscription(SUBSCRIBER_NEW)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
147
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
148 def cb2(state):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
149 assertEqual(state, 'pending')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
150
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
151 d = self.node.add_subscription(SUBSCRIBER_NEW, 'pending')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
152 d.addCallback(cb1)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
153 d.addCallback(cb2)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
154 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
155
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
156 def testAddExistingSubscription(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
157 d = self.node.add_subscription(SUBSCRIBER, 'pending')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
158 assertFailure(d, storage.SubscriptionExists)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
159 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
160
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
161 def testGetSubscription(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
162 def cb(subscriptions):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
163 assertEquals(subscriptions[0][1], 'subscribed')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
164 assertEquals(subscriptions[1][1], 'pending')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
165 assertEquals(subscriptions[2][1], None)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
166
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
167 d = defer.DeferredList([self.node.get_subscription(SUBSCRIBER),
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
168 self.node.get_subscription(SUBSCRIBER_PENDING),
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
169 self.node.get_subscription(OWNER)])
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
170 d.addCallback(cb)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
171 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
172
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
173 def testRemoveSubscription(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
174 return self.node.remove_subscription(SUBSCRIBER_TO_BE_DELETED)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
175
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
176 def testRemoveNonExistingSubscription(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
177 d = self.node.remove_subscription(OWNER)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
178 assertFailure(d, storage.SubscriptionNotFound)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
179 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
180
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
181 def testGetSubscribers(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
182 def cb(subscribers):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
183 assertIn(SUBSCRIBER, subscribers)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
184 assertNotIn(SUBSCRIBER_PENDING, subscribers)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
185 assertNotIn(OWNER, subscribers)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
186
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
187 d = self.node.get_subscribers()
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
188 d.addCallback(cb)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
189 return d
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
190
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
191 def testIsSubscriber(self):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
192 def cb(subscribed):
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
193 assertEquals(subscribed[0][1], True)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
194 assertEquals(subscribed[1][1], False)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
195 assertEquals(subscribed[2][1], False)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
196
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
197 d = defer.DeferredList([self.node.is_subscribed(SUBSCRIBER),
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
198 self.node.is_subscribed(SUBSCRIBER_PENDING),
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
199 self.node.is_subscribed(OWNER)])
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
200 d.addCallback(cb)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
201 return d
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
202
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
203 class MemoryStorageStorageTestCase(unittest.TestCase, StorageTests):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
204
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
205 def setUpClass(self):
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
206 from idavoll.memory_storage import Storage, LeafNode, Subscription, \
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
207 default_config
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
208 self.s = Storage()
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
209 self.s._nodes['pre-existing'] = \
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
210 LeafNode('pre-existing', OWNER, default_config)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
211 self.s._nodes['to-be-deleted'] = \
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
212 LeafNode('to-be-deleted', OWNER, None)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
213 self.s._nodes['to-be-reconfigured'] = \
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
214 LeafNode('to-be-reconfigured', OWNER, default_config)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
215
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
216 subscriptions = self.s._nodes['pre-existing']._subscriptions
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
217 subscriptions[SUBSCRIBER.full()] = Subscription('subscribed')
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
218 subscriptions[SUBSCRIBER_TO_BE_DELETED.full()] = \
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
219 Subscription('subscribed')
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
220 subscriptions[SUBSCRIBER_PENDING.full()] = \
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
221 Subscription('pending')
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
222
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
223 return StorageTests.setUpClass(self)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
224
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
225 class PgsqlStorageStorageTestCase(unittest.TestCase, StorageTests):
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
226 def _callSuperSetUpClass(self, void):
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
227 return StorageTests.setUpClass(self)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
228
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
229 def setUpClass(self):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
230 from idavoll.pgsql_storage import Storage
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
231 self.s = Storage('ralphm', 'pubsub_test')
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
232 self.s._dbpool.start()
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
233 d = self.s._dbpool.runInteraction(self.init)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
234 d.addCallback(self._callSuperSetUpClass)
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
235 return d
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
236
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
237 def tearDownClass(self):
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
238 # return self.s._dbpool.runInteraction(self.cleandb)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
239 pass
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
240
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
241 def init(self, cursor):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
242 self.cleandb(cursor)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
243 cursor.execute("""INSERT INTO nodes (node) VALUES ('pre-existing')""")
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
244 cursor.execute("""INSERT INTO nodes (node) VALUES ('to-be-deleted')""")
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
245 cursor.execute("""INSERT INTO nodes (node) VALUES ('to-be-reconfigured')""")
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
246 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""",
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
247 OWNER.userhost().encode('utf-8'))
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
248 cursor.execute("""INSERT INTO affiliations
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
249 (node_id, entity_id, affiliation)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
250 SELECT nodes.id, entities.id, 'owner'
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
251 FROM nodes, entities
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
252 WHERE node='pre-existing' AND jid=%s""",
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
253 OWNER.userhost().encode('utf-8'))
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
254 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""",
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
255 SUBSCRIBER.userhost().encode('utf-8'))
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
256 cursor.execute("""INSERT INTO subscriptions
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
257 (node_id, entity_id, resource, subscription)
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
258 SELECT nodes.id, entities.id, %s, 'subscribed'
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
259 FROM nodes, entities
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
260 WHERE node='pre-existing' AND jid=%s""",
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
261 (SUBSCRIBER.resource.encode('utf-8'),
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
262 SUBSCRIBER.userhost().encode('utf-8')))
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
263 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""",
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
264 SUBSCRIBER_TO_BE_DELETED.userhost().encode('utf-8'))
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
265 cursor.execute("""INSERT INTO subscriptions
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
266 (node_id, entity_id, resource, subscription)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
267 SELECT nodes.id, entities.id, %s, 'subscribed'
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
268 FROM nodes, entities
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
269 WHERE node='pre-existing' AND jid=%s""",
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
270 (SUBSCRIBER_TO_BE_DELETED.resource.encode('utf-8'),
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
271 SUBSCRIBER_TO_BE_DELETED.userhost().encode('utf-8')))
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
272 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""",
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
273 SUBSCRIBER_PENDING.userhost().encode('utf-8'))
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
274 cursor.execute("""INSERT INTO subscriptions
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
275 (node_id, entity_id, resource, subscription)
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
276 SELECT nodes.id, entities.id, %s, 'pending'
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
277 FROM nodes, entities
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
278 WHERE node='pre-existing' AND jid=%s""",
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
279 (SUBSCRIBER_PENDING.resource.encode('utf-8'),
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
280 SUBSCRIBER_PENDING.userhost().encode('utf-8')))
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
281
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
282 def cleandb(self, cursor):
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
283 cursor.execute("""DELETE FROM nodes WHERE node in
117
bc872c33e88c Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 114
diff changeset
284 ('non-existing', 'pre-existing', 'to-be-deleted',
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
285 'new 1', 'new 2', 'new 3', 'to-be-reconfigured')""")
114
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
286 cursor.execute("""DELETE FROM entities WHERE jid=%s""",
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
287 OWNER.userhost().encode('utf-8'))
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
288 cursor.execute("""DELETE FROM entities WHERE jid=%s""",
e7cfe05bc1d2 Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
289 SUBSCRIBER.userhost().encode('utf-8'))
123
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
290 cursor.execute("""DELETE FROM entities WHERE jid=%s""",
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
291 SUBSCRIBER_TO_BE_DELETED.userhost().encode('utf-8'))
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
292 cursor.execute("""DELETE FROM entities WHERE jid=%s""",
8f99b4f7aea2 Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents: 117
diff changeset
293 SUBSCRIBER_PENDING.userhost().encode('utf-8'))