Mercurial > libervia-pubsub
annotate idavoll/test/test_storage.py @ 138:635e433810ef
Actually test whether the item was indeed stored.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Mon, 25 Apr 2005 13:02:37 +0000 |
parents | aca904a41a43 |
children | 8f6956b9a688 |
rev | line source |
---|---|
114 | 1 from twisted.trial import unittest |
2 from twisted.trial.assertions import * | |
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 |
131 | 5 from twisted.xish import domish |
114 | 6 |
131 | 7 from idavoll import storage, pubsub |
114 | 8 |
9 OWNER = jid.JID('owner@example.com') | |
10 SUBSCRIBER = jid.JID('subscriber@example.com/Home') | |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
11 SUBSCRIBER_NEW = jid.JID('new@example.com/Home') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
12 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
|
13 SUBSCRIBER_PENDING = jid.JID('pending@example.com/Home') |
131 | 14 PUBLISHER = jid.JID('publisher@example.com') |
15 ITEM = domish.Element((pubsub.NS_PUBSUB, 'item'), pubsub.NS_PUBSUB) | |
16 ITEM['id'] = 'current' | |
17 ITEM.addElement(('testns', 'test'), content=u'Test \u2083 item') | |
18 ITEM_NEW = domish.Element((pubsub.NS_PUBSUB, 'item'), pubsub.NS_PUBSUB) | |
19 ITEM_NEW['id'] = 'new' | |
20 ITEM_NEW.addElement(('testns', 'test'), content=u'Test \u2083 item') | |
21 ITEM_UPDATED = domish.Element((pubsub.NS_PUBSUB, 'item'), pubsub.NS_PUBSUB) | |
22 ITEM_UPDATED['id'] = 'current' | |
23 ITEM_UPDATED.addElement(('testns', 'test'), content=u'Test \u2084 item') | |
24 ITEM_TO_BE_DELETED = domish.Element((pubsub.NS_PUBSUB, 'item'), | |
25 pubsub.NS_PUBSUB) | |
26 ITEM_TO_BE_DELETED['id'] = 'to-be-deleted' | |
27 ITEM_TO_BE_DELETED.addElement(('testns', 'test'), content=u'Test \u2083 item') | |
28 ITEM_TO_NOT_BE_DELETED = domish.Element((pubsub.NS_PUBSUB, 'item'), | |
29 pubsub.NS_PUBSUB) | |
30 ITEM_TO_NOT_BE_DELETED['id'] = 'to-not-be-deleted' | |
31 ITEM_TO_NOT_BE_DELETED.addElement(('testns', 'test'), | |
32 content=u'Test \u2083 item') | |
114 | 33 |
34 class StorageTests: | |
35 | |
117
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
36 def _assignTestNode(self, node): |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
37 self.node = node |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
38 |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
39 def setUpClass(self): |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
40 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
|
41 d.addCallback(self._assignTestNode) |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
42 return d |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
43 |
114 | 44 def testGetNode(self): |
45 return self.s.get_node('pre-existing') | |
46 | |
47 def testGetNonExistingNode(self): | |
48 d = self.s.get_node('non-existing') | |
49 assertFailure(d, storage.NodeNotFound) | |
50 return d | |
51 | |
52 def testGetNodeIDs(self): | |
53 def cb(node_ids): | |
54 assertIn('pre-existing', node_ids) | |
55 assertNotIn('non-existing', node_ids) | |
56 | |
57 return self.s.get_node_ids().addCallback(cb) | |
58 | |
59 def testCreateExistingNode(self): | |
60 d = self.s.create_node('pre-existing', OWNER) | |
61 assertFailure(d, storage.NodeExists) | |
62 return d | |
63 | |
64 def testCreateNode(self): | |
65 def cb(void): | |
66 d = self.s.get_node('new 1') | |
67 return d | |
68 | |
69 d = self.s.create_node('new 1', OWNER) | |
70 d.addCallback(cb) | |
71 return d | |
72 | |
73 def testDeleteNonExistingNode(self): | |
74 d = self.s.delete_node('non-existing') | |
75 assertFailure(d, storage.NodeNotFound) | |
76 return d | |
77 | |
78 def testDeleteNode(self): | |
79 def cb(void): | |
80 d = self.s.get_node('to-be-deleted') | |
81 assertFailure(d, storage.NodeNotFound) | |
82 return d | |
83 | |
84 d = self.s.delete_node('to-be-deleted') | |
85 d.addCallback(cb) | |
86 return d | |
87 | |
88 def testGetAffiliations(self): | |
89 def cb(affiliations): | |
90 assertIn(('pre-existing', 'owner'), affiliations) | |
91 | |
92 d = self.s.get_affiliations(OWNER) | |
93 d.addCallback(cb) | |
94 return d | |
95 | |
96 def testGetSubscriptions(self): | |
97 def cb(subscriptions): | |
98 assertIn(('pre-existing', SUBSCRIBER, 'subscribed'), subscriptions) | |
99 | |
100 d = self.s.get_subscriptions(SUBSCRIBER) | |
101 d.addCallback(cb) | |
102 return d | |
103 | |
117
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
104 # Node tests |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
105 |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
106 def testGetType(self): |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
107 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
|
108 |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
109 def testGetConfiguration(self): |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
116 def testSetConfiguration(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
117 def get_config(node): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
118 d = node.set_configuration({'pubsub#persist_items': False}) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
119 d.addCallback(lambda _: node) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
120 return d |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
121 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
122 def check_object_config(node): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
123 config = node.get_configuration() |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
124 assertEqual(config['pubsub#persist_items'], False) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
125 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
126 def get_node(void): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
127 return self.s.get_node('to-be-reconfigured') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
128 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
129 def check_storage_config(node): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
130 config = node.get_configuration() |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
131 assertEqual(config['pubsub#persist_items'], False) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
132 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
133 d = self.s.get_node('to-be-reconfigured') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
134 d.addCallback(get_config) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
135 d.addCallback(check_object_config) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
136 d.addCallback(get_node) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
137 d.addCallback(check_storage_config) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
138 return d |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
139 |
117
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
140 def testGetMetaData(self): |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
148 def testGetAffiliation(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
149 def cb(affiliation): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
150 assertEqual(affiliation, 'owner') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
151 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
152 d = self.node.get_affiliation(OWNER) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
153 d.addCallback(cb) |
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 testGetNonExistingAffiliation(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
157 def cb(affiliation): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
158 assertEqual(affiliation, None) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
159 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
160 d = self.node.get_affiliation(SUBSCRIBER) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
161 d.addCallback(cb) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
162 return d |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
163 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
164 def testAddSubscription(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
165 def cb1(void): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
166 return self.node.get_subscription(SUBSCRIBER_NEW) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
167 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
168 def cb2(state): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
169 assertEqual(state, 'pending') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
170 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
171 d = self.node.add_subscription(SUBSCRIBER_NEW, 'pending') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
172 d.addCallback(cb1) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
173 d.addCallback(cb2) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
174 return d |
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 testAddExistingSubscription(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
177 d = self.node.add_subscription(SUBSCRIBER, 'pending') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
178 assertFailure(d, storage.SubscriptionExists) |
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 testGetSubscription(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
182 def cb(subscriptions): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
183 assertEquals(subscriptions[0][1], 'subscribed') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
184 assertEquals(subscriptions[1][1], 'pending') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
185 assertEquals(subscriptions[2][1], None) |
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 = defer.DeferredList([self.node.get_subscription(SUBSCRIBER), |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
188 self.node.get_subscription(SUBSCRIBER_PENDING), |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
189 self.node.get_subscription(OWNER)]) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
190 d.addCallback(cb) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
191 return d |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
192 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
193 def testRemoveSubscription(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
194 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
|
195 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
196 def testRemoveNonExistingSubscription(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
197 d = self.node.remove_subscription(OWNER) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
198 assertFailure(d, storage.SubscriptionNotFound) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
199 return d |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
200 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
201 def testGetSubscribers(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
202 def cb(subscribers): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
203 assertIn(SUBSCRIBER, subscribers) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
204 assertNotIn(SUBSCRIBER_PENDING, subscribers) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
205 assertNotIn(OWNER, subscribers) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
206 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
207 d = self.node.get_subscribers() |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
208 d.addCallback(cb) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
209 return d |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
210 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
211 def testIsSubscriber(self): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
212 def cb(subscribed): |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
213 assertEquals(subscribed[0][1], True) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
214 assertEquals(subscribed[1][1], False) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
215 assertEquals(subscribed[2][1], False) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
216 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
217 d = defer.DeferredList([self.node.is_subscribed(SUBSCRIBER), |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
218 self.node.is_subscribed(SUBSCRIBER_PENDING), |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
219 self.node.is_subscribed(OWNER)]) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
220 d.addCallback(cb) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
221 return d |
117
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
222 |
131 | 223 def testStoreItems(self): |
138
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
224 def cb1(void): |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
225 return self.node.get_items_by_id(['new']) |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
226 |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
227 def cb2(result): |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
228 assertEqual(result[0], unicode(ITEM_NEW.toXml(), 'utf-8')) |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
229 |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
230 d = self.node.store_items([ITEM_NEW], PUBLISHER) |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
231 d.addCallback(cb1) |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
232 d.addCallback(cb2) |
635e433810ef
Actually test whether the item was indeed stored.
Ralph Meijer <ralphm@ik.nu>
parents:
137
diff
changeset
|
233 return d |
131 | 234 |
235 def testStoreUpdatedItems(self): | |
236 def cb1(void): | |
237 return self.node.get_items_by_id(['current']) | |
238 | |
239 def cb2(result): | |
240 assertEqual(result[0], unicode(ITEM_UPDATED.toXml(), 'utf-8')) | |
241 | |
242 d = self.node.store_items([ITEM_UPDATED], PUBLISHER) | |
243 d.addCallback(cb1) | |
244 d.addCallback(cb2) | |
245 return d | |
246 | |
247 def testRemoveItems(self): | |
248 def cb1(void): | |
249 return self.node.get_items_by_id(['to-be-deleted']) | |
250 | |
251 def cb2(result): | |
252 assertEqual(len(result), 0) | |
253 | |
254 d = self.node.remove_items(['to-be-deleted']) | |
255 d.addCallback(cb1) | |
256 d.addCallback(cb2) | |
257 return d | |
258 | |
259 def testRemoveNonExistingItems(self): | |
260 d = self.node.remove_items(['to-not-be-deleted', 'non-existing']) | |
261 assertFailure(d, storage.ItemNotFound) | |
262 return d | |
263 | |
264 def testGetItems(self): | |
265 def cb(result): | |
266 assertIn(unicode(ITEM.toXml(), 'utf-8'), result) | |
267 | |
268 d = self.node.get_items() | |
269 d.addCallback(cb) | |
270 return d | |
271 | |
272 def testLastItem(self): | |
273 def cb(result): | |
274 assertEqual([unicode(ITEM.toXml(), 'utf-8')], result) | |
275 | |
276 d = self.node.get_items(1) | |
277 d.addCallback(cb) | |
278 return d | |
279 | |
280 def testGetItemsById(self): | |
281 def cb(result): | |
282 assertEqual(len(result), 1) | |
283 | |
284 d = self.node.get_items_by_id(['current']) | |
285 d.addCallback(cb) | |
286 return d | |
287 | |
288 def testGetNonExistingItemsById(self): | |
289 def cb(result): | |
290 assertEqual(len(result), 0) | |
291 | |
292 d = self.node.get_items_by_id(['non-existing']) | |
293 d.addCallback(cb) | |
294 return d | |
295 | |
296 def testPurge(self): | |
297 def cb1(node): | |
298 d = node.purge() | |
299 d.addCallback(lambda _: node) | |
300 return d | |
301 | |
302 def cb2(node): | |
303 return node.get_items() | |
304 | |
305 def cb3(result): | |
306 assertEqual([], result) | |
307 | |
308 d = self.s.get_node('to-be-purged') | |
309 d.addCallback(cb1) | |
310 d.addCallback(cb2) | |
311 d.addCallback(cb3) | |
312 return d | |
313 | |
114 | 314 class MemoryStorageStorageTestCase(unittest.TestCase, StorageTests): |
315 | |
316 def setUpClass(self): | |
117
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
317 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
|
318 default_config |
114 | 319 self.s = Storage() |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
320 self.s._nodes['pre-existing'] = \ |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
321 LeafNode('pre-existing', OWNER, default_config) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
322 self.s._nodes['to-be-deleted'] = \ |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
323 LeafNode('to-be-deleted', OWNER, None) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
324 self.s._nodes['to-be-reconfigured'] = \ |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
325 LeafNode('to-be-reconfigured', OWNER, default_config) |
131 | 326 self.s._nodes['to-be-purged'] = \ |
327 LeafNode('to-be-purged', OWNER, None) | |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
328 |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
329 subscriptions = self.s._nodes['pre-existing']._subscriptions |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
330 subscriptions[SUBSCRIBER.full()] = Subscription('subscribed') |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
331 subscriptions[SUBSCRIBER_TO_BE_DELETED.full()] = \ |
114 | 332 Subscription('subscribed') |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
333 subscriptions[SUBSCRIBER_PENDING.full()] = \ |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
334 Subscription('pending') |
114 | 335 |
131 | 336 item = (ITEM_TO_BE_DELETED.toXml(), PUBLISHER) |
337 self.s._nodes['pre-existing']._items['to-be-deleted'] = item | |
338 self.s._nodes['pre-existing']._itemlist.append(item) | |
339 self.s._nodes['pre-existing']._items['to-not-be-deleted'] = item | |
340 self.s._nodes['pre-existing']._itemlist.append(item) | |
341 self.s._nodes['to-be-purged']._items['to-be-deleted'] = item | |
342 self.s._nodes['to-be-purged']._itemlist.append(item) | |
343 item = (ITEM.toXml(), PUBLISHER) | |
344 self.s._nodes['pre-existing']._items['current'] = item | |
345 self.s._nodes['pre-existing']._itemlist.append(item) | |
346 | |
117
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
347 return StorageTests.setUpClass(self) |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
348 |
114 | 349 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
|
350 def _callSuperSetUpClass(self, void): |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
351 return StorageTests.setUpClass(self) |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
352 |
114 | 353 def setUpClass(self): |
354 from idavoll.pgsql_storage import Storage | |
355 self.s = Storage('ralphm', 'pubsub_test') | |
356 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
|
357 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
|
358 d.addCallback(self._callSuperSetUpClass) |
bc872c33e88c
Added test cases for a few of the Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
114
diff
changeset
|
359 return d |
114 | 360 |
361 def tearDownClass(self): | |
131 | 362 #return self.s._dbpool.runInteraction(self.cleandb) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
363 pass |
114 | 364 |
365 def init(self, cursor): | |
366 self.cleandb(cursor) | |
367 cursor.execute("""INSERT INTO nodes (node) VALUES ('pre-existing')""") | |
368 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
|
369 cursor.execute("""INSERT INTO nodes (node) VALUES ('to-be-reconfigured')""") |
131 | 370 cursor.execute("""INSERT INTO nodes (node) VALUES ('to-be-purged')""") |
114 | 371 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
372 OWNER.userhost()) |
114 | 373 cursor.execute("""INSERT INTO affiliations |
374 (node_id, entity_id, affiliation) | |
375 SELECT nodes.id, entities.id, 'owner' | |
376 FROM nodes, entities | |
377 WHERE node='pre-existing' AND jid=%s""", | |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
378 OWNER.userhost()) |
114 | 379 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
380 SUBSCRIBER.userhost()) |
114 | 381 cursor.execute("""INSERT INTO subscriptions |
382 (node_id, entity_id, resource, subscription) | |
383 SELECT nodes.id, entities.id, %s, 'subscribed' | |
384 FROM nodes, entities | |
385 WHERE node='pre-existing' AND jid=%s""", | |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
386 (SUBSCRIBER.resource, |
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
387 SUBSCRIBER.userhost())) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
388 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
389 SUBSCRIBER_TO_BE_DELETED.userhost()) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
390 cursor.execute("""INSERT INTO subscriptions |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
391 (node_id, entity_id, resource, subscription) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
392 SELECT nodes.id, entities.id, %s, 'subscribed' |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
393 FROM nodes, entities |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
394 WHERE node='pre-existing' AND jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
395 (SUBSCRIBER_TO_BE_DELETED.resource, |
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
396 SUBSCRIBER_TO_BE_DELETED.userhost())) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
397 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
398 SUBSCRIBER_PENDING.userhost()) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
399 cursor.execute("""INSERT INTO subscriptions |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
400 (node_id, entity_id, resource, subscription) |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
401 SELECT nodes.id, entities.id, %s, 'pending' |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
402 FROM nodes, entities |
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
403 WHERE node='pre-existing' AND jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
404 (SUBSCRIBER_PENDING.resource, |
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
405 SUBSCRIBER_PENDING.userhost())) |
131 | 406 cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
407 PUBLISHER.userhost()) |
131 | 408 cursor.execute("""INSERT INTO items |
409 (node_id, publisher, item, data, date) | |
410 SELECT nodes.id, %s, 'to-be-deleted', %s, | |
411 now() - interval '1 day' | |
412 FROM nodes | |
413 WHERE node='pre-existing'""", | |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
414 (PUBLISHER.userhost(), |
131 | 415 ITEM_TO_BE_DELETED.toXml())) |
416 cursor.execute("""INSERT INTO items | |
417 (node_id, publisher, item, data, date) | |
418 SELECT nodes.id, %s, 'to-not-be-deleted', %s, | |
419 now() - interval '1 day' | |
420 FROM nodes | |
421 WHERE node='pre-existing'""", | |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
422 (PUBLISHER.userhost(), |
131 | 423 ITEM_TO_NOT_BE_DELETED.toXml())) |
424 cursor.execute("""INSERT INTO items (node_id, publisher, item, data) | |
425 SELECT nodes.id, %s, 'to-be-deleted', %s | |
426 FROM nodes | |
427 WHERE node='to-be-purged'""", | |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
428 (PUBLISHER.userhost(), |
131 | 429 ITEM_TO_BE_DELETED.toXml())) |
430 cursor.execute("""INSERT INTO items (node_id, publisher, item, data) | |
431 SELECT nodes.id, %s, 'current', %s | |
432 FROM nodes | |
433 WHERE node='pre-existing'""", | |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
434 (PUBLISHER.userhost(), |
131 | 435 ITEM.toXml())) |
114 | 436 |
437 def cleandb(self, cursor): | |
438 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
|
439 ('non-existing', 'pre-existing', 'to-be-deleted', |
131 | 440 'new 1', 'new 2', 'new 3', 'to-be-reconfigured', |
441 'to-be-purged')""") | |
114 | 442 cursor.execute("""DELETE FROM entities WHERE jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
443 OWNER.userhost()) |
114 | 444 cursor.execute("""DELETE FROM entities WHERE jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
445 SUBSCRIBER.userhost()) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
446 cursor.execute("""DELETE FROM entities WHERE jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
447 SUBSCRIBER_TO_BE_DELETED.userhost()) |
123
8f99b4f7aea2
Add tests for all Node methods.
Ralph Meijer <ralphm@ik.nu>
parents:
117
diff
changeset
|
448 cursor.execute("""DELETE FROM entities WHERE jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
449 SUBSCRIBER_PENDING.userhost()) |
131 | 450 cursor.execute("""DELETE FROM entities WHERE jid=%s""", |
137
aca904a41a43
Discover client_encoding parameter to pyPgSQL.
Ralph Meijer <ralphm@ik.nu>
parents:
131
diff
changeset
|
451 PUBLISHER.userhost()) |