Skip to content

Commit 0958f31

Browse files
committed
added a couple of xmlrpc tests for untested functions/codepaths
1 parent 61ec8a8 commit 0958f31

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

test/test_xmlrpc.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,58 @@ def testFileCreate(self):
9393
results = self.server.display(fileid, 'content')
9494
self.assertEqual(results['content'], 'hello\r\nthere')
9595

96+
def testSchema(self):
97+
schema={'status': [('order', '<roundup.hyperdb.Number>'),
98+
('name', '<roundup.hyperdb.String>')],
99+
'keyword': [('name', '<roundup.hyperdb.String>')],
100+
'priority': [('order', '<roundup.hyperdb.Number>'),
101+
('name', '<roundup.hyperdb.String>')],
102+
'user': [('username', '<roundup.hyperdb.String>'),
103+
('alternate_addresses', '<roundup.hyperdb.String>'),
104+
('realname', '<roundup.hyperdb.String>'),
105+
('roles', '<roundup.hyperdb.String>'),
106+
('organisation', '<roundup.hyperdb.String>'),
107+
('queries', '<roundup.hyperdb.Multilink to "query">'),
108+
('phone', '<roundup.hyperdb.String>'),
109+
('address', '<roundup.hyperdb.String>'),
110+
('timezone', '<roundup.hyperdb.String>'),
111+
('password', '<roundup.hyperdb.Password>')],
112+
'file': [('content', '<roundup.hyperdb.String>'),
113+
('type', '<roundup.hyperdb.String>'),
114+
('name', '<roundup.hyperdb.String>')],
115+
'msg': [('files', '<roundup.hyperdb.Multilink to "file">'),
116+
('inreplyto', '<roundup.hyperdb.String>'),
117+
('tx_Source', '<roundup.hyperdb.String>'),
118+
('recipients', '<roundup.hyperdb.Multilink to "user">'),
119+
('author', '<roundup.hyperdb.Link to "user">'),
120+
('summary', '<roundup.hyperdb.String>'),
121+
('content', '<roundup.hyperdb.String>'),
122+
('messageid', '<roundup.hyperdb.String>'),
123+
('date', '<roundup.hyperdb.Date>'),
124+
('type', '<roundup.hyperdb.String>')],
125+
'query': [('url', '<roundup.hyperdb.String>'),
126+
('private_for', '<roundup.hyperdb.Link to "user">'),
127+
('name', '<roundup.hyperdb.String>'),
128+
('klass', '<roundup.hyperdb.String>')],
129+
'issue': [('status', '<roundup.hyperdb.Link to "status">'),
130+
('files', '<roundup.hyperdb.Multilink to "file">'),
131+
('tx_Source', '<roundup.hyperdb.String>'),
132+
('keyword', '<roundup.hyperdb.Multilink to "keyword">'),
133+
('title', '<roundup.hyperdb.String>'),
134+
('nosy', '<roundup.hyperdb.Multilink to "user">'),
135+
('messages', '<roundup.hyperdb.Multilink to "msg">'),
136+
('priority', '<roundup.hyperdb.Link to "priority">'),
137+
('assignedto', '<roundup.hyperdb.Link to "user">'),
138+
('superseder', '<roundup.hyperdb.Multilink to "issue">')]}
139+
140+
results = self.server.schema()
141+
self.assertEqual(results, schema)
142+
143+
def testLookup(self):
144+
self.assertRaises(KeyError, self.server.lookup, 'user', '1')
145+
results = self.server.lookup('user', 'admin')
146+
self.assertEqual(results, '1')
147+
96148
def testAction(self):
97149
# As this action requires special previledges, we temporarily switch
98150
# to 'admin'
@@ -106,6 +158,13 @@ def testAction(self):
106158
users_after = self.server.list('user')
107159
self.assertEqual(users_before, users_after)
108160

161+
# test a bogus action
162+
with self.assertRaises(Exception) as cm:
163+
self.server.action('bogus')
164+
print cm.exception
165+
self.assertEqual(cm.exception.message,
166+
'action "bogus" is not supported ')
167+
109168
def testAuthDeniedEdit(self):
110169
# Wrong permissions (caught by roundup security module).
111170
self.assertRaises(Unauthorised, self.server.set,

0 commit comments

Comments
 (0)