Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.
This commit is contained in:
parent
f92a275d54
commit
7331ae3df5
1 changed files with 18 additions and 38 deletions
|
|
@ -702,63 +702,43 @@ class BasicFunctionalityTestCase(FlaskTestCase):
|
||||||
def subdomain():
|
def subdomain():
|
||||||
return 'Foo SubDomain'
|
return 'Foo SubDomain'
|
||||||
|
|
||||||
try:
|
rv = app.test_client().get('/')
|
||||||
rv = app.test_client().get('/')
|
self.assert_equal(rv.data, 'Foo')
|
||||||
self.assert_equal(rv.data, 'Foo')
|
|
||||||
except ValueError, e:
|
|
||||||
raise ValueError(
|
|
||||||
"No ValueError exception should have been raised \"%s\"" % e
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
rv = app.test_client().get('/', 'http://localhost.localdomain:5000')
|
||||||
rv = app.test_client().get('/', 'http://localhost.localdomain:5000')
|
self.assert_equal(rv.data, 'Foo')
|
||||||
self.assert_equal(rv.data, 'Foo')
|
|
||||||
except ValueError, e:
|
|
||||||
raise ValueError(
|
|
||||||
"No ValueError exception should have been raised \"%s\"" % e
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
rv = app.test_client().get('/', 'https://localhost.localdomain:5000')
|
||||||
rv = app.test_client().get('/', 'https://localhost.localdomain:5000')
|
self.assert_equal(rv.data, 'Foo')
|
||||||
self.assert_equal(rv.data, 'Foo')
|
|
||||||
except ValueError, e:
|
|
||||||
raise ValueError(
|
|
||||||
"No ValueError exception should have been raised \"%s\"" % e
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
app.config.update(SERVER_NAME='localhost.localdomain')
|
||||||
app.config.update(SERVER_NAME='localhost.localdomain')
|
rv = app.test_client().get('/', 'https://localhost.localdomain')
|
||||||
rv = app.test_client().get('/', 'https://localhost.localdomain')
|
self.assert_equal(rv.data, 'Foo')
|
||||||
self.assert_equal(rv.data, 'Foo')
|
|
||||||
except ValueError, e:
|
|
||||||
raise ValueError(
|
|
||||||
"No ValueError exception should have been raised \"%s\"" % e
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
app.config.update(SERVER_NAME='localhost.localdomain:443')
|
app.config.update(SERVER_NAME='localhost.localdomain:443')
|
||||||
rv = app.test_client().get('/', 'https://localhost.localdomain')
|
rv = app.test_client().get('/', 'https://localhost.localdomain')
|
||||||
self.assert_equal(rv.data, 'Foo')
|
# Werkzeug 0.8
|
||||||
|
self.assert_equal(rv.status_code, 404)
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
|
# Werkzeug 0.7
|
||||||
self.assert_equal(str(e), "the server name provided " +
|
self.assert_equal(str(e), "the server name provided " +
|
||||||
"('localhost.localdomain:443') does not match the " + \
|
"('localhost.localdomain:443') does not match the " + \
|
||||||
"server name from the WSGI environment ('localhost.localdomain')")
|
"server name from the WSGI environment ('localhost.localdomain')")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
app.config.update(SERVER_NAME='localhost.localdomain')
|
app.config.update(SERVER_NAME='localhost.localdomain')
|
||||||
app.test_client().get('/', 'http://foo.localhost')
|
rv = app.test_client().get('/', 'http://foo.localhost')
|
||||||
|
# Werkzeug 0.8
|
||||||
|
self.assert_equal(rv.status_code, 404)
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
|
# Werkzeug 0.7
|
||||||
self.assert_equal(str(e), "the server name provided " + \
|
self.assert_equal(str(e), "the server name provided " + \
|
||||||
"('localhost.localdomain') does not match the " + \
|
"('localhost.localdomain') does not match the " + \
|
||||||
"server name from the WSGI environment ('foo.localhost')")
|
"server name from the WSGI environment ('foo.localhost')")
|
||||||
|
|
||||||
try:
|
rv = app.test_client().get('/', 'http://foo.localhost.localdomain')
|
||||||
rv = app.test_client().get('/', 'http://foo.localhost.localdomain')
|
self.assert_equal(rv.data, 'Foo SubDomain')
|
||||||
self.assert_equal(rv.data, 'Foo SubDomain')
|
|
||||||
except ValueError, e:
|
|
||||||
raise ValueError(
|
|
||||||
"No ValueError exception should have been raised \"%s\"" % e
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exception_propagation(self):
|
def test_exception_propagation(self):
|
||||||
def apprunner(configkey):
|
def apprunner(configkey):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue