annotate MoinMoin/xmlrpc/_tests/test_xmlrpc.py @ 6058:5fb9d0f4af89

decode some config default values for user profiles
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 12 Sep 2014 15:34:52 +0200
parents 263d4f8009f9
children
rev   line source
2166
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
2 """
2498
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
3 MoinMoin - tests for the xmlrpc module
2166
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
4
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
5 @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
7 """
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
8
2703
558a527c0ec7 tests: added py module import, cosmetic other changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2588
diff changeset
9 from xmlrpclib import Fault
558a527c0ec7 tests: added py module import, cosmetic other changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2588
diff changeset
10
2498
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
11 from MoinMoin.user import User
2166
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
12 from MoinMoin.xmlrpc import XmlRpcBase
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
13
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
14
2314
38b6ba04671b Fix issues pointed out by xorAxAx.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2166
diff changeset
15 def test_fault_serialization(request):
2498
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
16 """test MoinMoin.xmlrpc.xmlrpc_system_multicall Fault serialization"""
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
17
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
18 def xmlrpc_return_fault():
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
19 return Fault(666, "Fault description")
3b3b76b2225c Add a test case for XmlRpcBase._generate_auth_token
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2497
diff changeset
20
2314
38b6ba04671b Fix issues pointed out by xorAxAx.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2166
diff changeset
21 xmlrpc = XmlRpcBase(request)
2166
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
22 xmlrpc.xmlrpc_return_fault = xmlrpc_return_fault
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2275
diff changeset
23 args = [{'methodName': 'return_fault', 'params': []}]
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2275
diff changeset
24
2166
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
25 print """If a XML RPC method returns a Fault, we should get a failure response
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
26 instead of a serialized Fault, as it happened in the past. See revision
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
27 8b7d6d70fc95 for details"""
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2275
diff changeset
28
2166
2a7b535b1e44 Add a test for xmlrpc Fault serialization.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
29 result = xmlrpc.xmlrpc_system_multicall(args)
2703
558a527c0ec7 tests: added py module import, cosmetic other changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2588
diff changeset
30 assert type(result[0]) is dict
2314
38b6ba04671b Fix issues pointed out by xorAxAx.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2166
diff changeset
31 assert result[0].has_key("faultCode") and result[0].has_key("faultString")
2275
023e0f0d264e tests: rename test_tab to test_sourcecode, also test for sourcefiles not ending with a newline char
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2270
diff changeset
32
2588
5ae633bf2de5 add test for xmlrpc getAuthToken
Ville-Pekka Vainio <vpivaini AT cs DOT helsinki DOT fi>
parents: 2498
diff changeset
33 def test_getAuthToken(request):
5ae633bf2de5 add test for xmlrpc getAuthToken
Ville-Pekka Vainio <vpivaini AT cs DOT helsinki DOT fi>
parents: 2498
diff changeset
34 """ Tests if getAuthToken passes without crashing """
5ae633bf2de5 add test for xmlrpc getAuthToken
Ville-Pekka Vainio <vpivaini AT cs DOT helsinki DOT fi>
parents: 2498
diff changeset
35 xmlrpc = XmlRpcBase(request)
5ae633bf2de5 add test for xmlrpc getAuthToken
Ville-Pekka Vainio <vpivaini AT cs DOT helsinki DOT fi>
parents: 2498
diff changeset
36 assert xmlrpc.xmlrpc_getAuthToken("Foo", "bar") == ""
2448
c9949c55ff5e add coverage_modules attribute for coverage testing
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2340
diff changeset
37
c9949c55ff5e add coverage_modules attribute for coverage testing
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2340
diff changeset
38 coverage_modules = ['MoinMoin.xmlrpc']
c9949c55ff5e add coverage_modules attribute for coverage testing
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2340
diff changeset
39