Imported Debian patch 4.0.5-6~numeezy
This commit is contained in:
committed by
Mario Fetka
parent
c44de33144
commit
10dfc9587b
@@ -22,19 +22,12 @@ Test the `ipaserver.rpc` module.
|
||||
"""
|
||||
|
||||
import json
|
||||
import pytest
|
||||
|
||||
import six
|
||||
|
||||
from ipatests.util import create_test_api, assert_equal, raises, PluginTester
|
||||
from ipatests.data import unicode_str
|
||||
from ipalib import errors, Command
|
||||
from ipaserver import rpcserver
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
pytestmark = pytest.mark.tier0
|
||||
|
||||
class StartResponse(object):
|
||||
def __init__(self):
|
||||
@@ -54,8 +47,7 @@ class StartResponse(object):
|
||||
|
||||
|
||||
def test_not_found():
|
||||
api = 'the api instance'
|
||||
f = rpcserver.HTTP_Status(api)
|
||||
f = rpcserver.HTTP_Status()
|
||||
t = rpcserver._not_found_template
|
||||
s = StartResponse()
|
||||
|
||||
@@ -80,8 +72,7 @@ def test_not_found():
|
||||
|
||||
|
||||
def test_bad_request():
|
||||
api = 'the api instance'
|
||||
f = rpcserver.HTTP_Status(api)
|
||||
f = rpcserver.HTTP_Status()
|
||||
t = rpcserver._bad_request_template
|
||||
s = StartResponse()
|
||||
|
||||
@@ -94,8 +85,7 @@ def test_bad_request():
|
||||
|
||||
|
||||
def test_internal_error():
|
||||
api = 'the api instance'
|
||||
f = rpcserver.HTTP_Status(api)
|
||||
f = rpcserver.HTTP_Status()
|
||||
t = rpcserver._internal_error_template
|
||||
s = StartResponse()
|
||||
|
||||
@@ -108,8 +98,7 @@ def test_internal_error():
|
||||
|
||||
|
||||
def test_unauthorized_error():
|
||||
api = 'the api instance'
|
||||
f = rpcserver.HTTP_Status(api)
|
||||
f = rpcserver.HTTP_Status()
|
||||
t = rpcserver._unauthorized_template
|
||||
s = StartResponse()
|
||||
|
||||
@@ -150,8 +139,7 @@ class test_session(object):
|
||||
[environ[k] for k in ('SCRIPT_NAME', 'PATH_INFO')]
|
||||
)
|
||||
|
||||
api = 'the api instance'
|
||||
inst = self.klass(api)
|
||||
inst = self.klass()
|
||||
inst.mount(app1, '/foo/stuff')
|
||||
inst.mount(app2, '/bar')
|
||||
|
||||
@@ -169,14 +157,13 @@ class test_session(object):
|
||||
pass
|
||||
|
||||
# Test that mount works:
|
||||
api = 'the api instance'
|
||||
inst = self.klass(api)
|
||||
inst = self.klass()
|
||||
inst.mount(app1, 'foo')
|
||||
assert inst['foo'] is app1
|
||||
assert list(inst) == ['foo']
|
||||
|
||||
# Test that Exception is raise if trying override a mount:
|
||||
e = raises(Exception, inst.mount, app2, 'foo')
|
||||
# Test that StandardError is raise if trying override a mount:
|
||||
e = raises(StandardError, inst.mount, app2, 'foo')
|
||||
assert str(e) == '%s.mount(): cannot replace %r with %r at %r' % (
|
||||
'wsgi_dispatch', app1, app2, 'foo'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user