Improve coverage of Env tests
This commit is contained in:
parent
cf99f733d9
commit
08b80b9306
@ -136,6 +136,7 @@ def test_SSL_PORT():
|
|||||||
with pytest.raises(Env.Error):
|
with pytest.raises(Env.Error):
|
||||||
Env()
|
Env()
|
||||||
os.environ['SSL_CERTFILE'] = 'certfile'
|
os.environ['SSL_CERTFILE'] = 'certfile'
|
||||||
|
Env()
|
||||||
os.environ.pop('SSL_PORT')
|
os.environ.pop('SSL_PORT')
|
||||||
assert_integer('SSL_PORT', 'ssl_port', None)
|
assert_integer('SSL_PORT', 'ssl_port', None)
|
||||||
|
|
||||||
@ -160,6 +161,13 @@ def test_MAX_SEND():
|
|||||||
def test_MAX_SUBS():
|
def test_MAX_SUBS():
|
||||||
assert_integer('MAX_SUBS', 'max_subs', 250000)
|
assert_integer('MAX_SUBS', 'max_subs', 250000)
|
||||||
|
|
||||||
|
def test_MAX_SESSIONS():
|
||||||
|
too_big = 1000000
|
||||||
|
os.environ['MAX_SESSIONS'] = str(too_big)
|
||||||
|
e = Env()
|
||||||
|
assert e.max_sessions < too_big
|
||||||
|
# Cannot test default as it may be lowered by the open file limit cap
|
||||||
|
|
||||||
def test_MAX_SESSION_SUBS():
|
def test_MAX_SESSION_SUBS():
|
||||||
assert_integer('MAX_SESSION_SUBS', 'max_session_subs', 50000)
|
assert_integer('MAX_SESSION_SUBS', 'max_session_subs', 50000)
|
||||||
|
|
||||||
@ -263,15 +271,22 @@ def test_clearnet_identity():
|
|||||||
os.environ['SSL_KEYFILE'] = 'keyfile'
|
os.environ['SSL_KEYFILE'] = 'keyfile'
|
||||||
Env()
|
Env()
|
||||||
os.environ['IRC'] = 'OK'
|
os.environ['IRC'] = 'OK'
|
||||||
with pytest.raises(Env.Error):
|
with pytest.raises(Env.Error) as err:
|
||||||
Env()
|
Env()
|
||||||
|
assert 'not a valid REPORT_HOST' in str(err)
|
||||||
os.environ.pop('IRC', None)
|
os.environ.pop('IRC', None)
|
||||||
os.environ['PEER_ANNOUNCE'] = 'OK'
|
os.environ['PEER_ANNOUNCE'] = 'OK'
|
||||||
with pytest.raises(Env.Error):
|
with pytest.raises(Env.Error) as err:
|
||||||
Env()
|
Env()
|
||||||
|
os.environ.pop('PEER_ANNOUNCE', None)
|
||||||
|
assert 'not a valid REPORT_HOST' in str(err)
|
||||||
|
|
||||||
|
os.environ['REPORT_HOST'] = '1.2.3.4'
|
||||||
os.environ['REPORT_SSL_PORT'] = os.environ['REPORT_TCP_PORT']
|
os.environ['REPORT_SSL_PORT'] = os.environ['REPORT_TCP_PORT']
|
||||||
with pytest.raises(Env.Error):
|
with pytest.raises(Env.Error) as err:
|
||||||
Env()
|
Env()
|
||||||
|
assert 'both resolve' in str(err)
|
||||||
|
|
||||||
os.environ['REPORT_SSL_PORT'] = '457'
|
os.environ['REPORT_SSL_PORT'] = '457'
|
||||||
os.environ['REPORT_HOST'] = 'foo.com'
|
os.environ['REPORT_HOST'] = 'foo.com'
|
||||||
e = Env()
|
e = Env()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user