Skip to content

Commit 4fc0981

Browse files
committed
ensure that negative tests fail
small cleanup in tlstest.py
1 parent 6bf3c8b commit 4fc0981

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/tlstest.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,10 @@ def connect():
499499
connection = connect()
500500
try:
501501
connection.handshakeClientCert(settings=settings)
502-
assert(False)
502+
assert False
503503
except TLSLocalAlert as alert:
504504
if alert.description != AlertDescription.illegal_parameter:
505-
raise
505+
raise
506506
connection.close()
507507
else:
508508
test_no += 1
@@ -821,7 +821,7 @@ def connect():
821821
connection.handshakeClientSRP("test", "garbage",
822822
serverName=address[0],
823823
session=session, settings=settings)
824-
assert(False)
824+
assert False
825825
except TLSRemoteAlert as alert:
826826
if alert.description != AlertDescription.bad_record_mac:
827827
raise
@@ -1051,7 +1051,7 @@ def connect():
10511051
settings.maxVersion = (3, 2)
10521052
try:
10531053
connection.handshakeClientCert(settings=settings)
1054-
assert()
1054+
assert False
10551055
except TLSRemoteAlert as alert:
10561056
if alert.description != AlertDescription.inappropriate_fallback:
10571057
raise
@@ -1147,6 +1147,7 @@ def connect():
11471147
try:
11481148
connection.handshakeClientCert(serverName=address[0], session=session,
11491149
settings=settings)
1150+
assert False
11501151
except TLSRemoteAlert as e:
11511152
assert(str(e) == "illegal_parameter")
11521153
else:
@@ -1381,7 +1382,8 @@ def heartbeat_response_check(message):
13811382

13821383
print("Test {0}: POP3 good".format(test_no))
13831384
except (socket.error, socket.timeout) as e:
1384-
print("Non-critical error: socket error trying to reach internet server: ", e)
1385+
print("Non-critical error: socket error trying to reach internet "
1386+
"server: ", e)
13851387

13861388
synchro.close()
13871389

@@ -1640,6 +1642,7 @@ def connect():
16401642
try:
16411643
connection.handshakeServer(certChain=x509ecdsaChain,
16421644
privateKey=x509ecdsaKey, settings=settings)
1645+
assert False
16431646
except TLSRemoteAlert as e:
16441647
assert "handshake_failure" in str(e)
16451648
connection.close()
@@ -1671,6 +1674,7 @@ def connect():
16711674
try:
16721675
connection.handshakeServer(certChain=x509ecdsaChain,
16731676
privateKey=x509ecdsaKey, settings=settings)
1677+
assert False
16741678
except TLSLocalAlert as e:
16751679
assert "No common signature algorithms" in str(e)
16761680
connection.close()
@@ -1777,7 +1781,7 @@ def connect():
17771781
try:
17781782
connection.handshakeServer(certChain=x509Chain, privateKey=x509Key,
17791783
tacks=[tackUnrelated], settings=settings)
1780-
assert(False)
1784+
assert False
17811785
except TLSRemoteAlert as alert:
17821786
if alert.description != AlertDescription.illegal_parameter:
17831787
raise
@@ -2078,13 +2082,14 @@ def connect():
20782082
synchro.send(b'R')
20792083
try:
20802084
connection.read(min=1, max=1)
2081-
assert() #Client is going to close the socket without a close_notify
2085+
assert False #Client is going to close the socket without a close_notify
20822086
except TLSAbruptCloseError as e:
20832087
pass
20842088
synchro.send(b'R')
20852089
connection = connect()
20862090
try:
20872091
connection.handshakeServer(verifierDB=verifierDB, sessionCache=sessionCache)
2092+
assert False
20882093
except TLSLocalAlert as alert:
20892094
if alert.description != AlertDescription.bad_record_mac:
20902095
raise
@@ -2293,7 +2298,7 @@ def server_bind(self):
22932298
try:
22942299
connection.handshakeServer(certChain=x509Chain, privateKey=x509Key,
22952300
settings=settings)
2296-
assert()
2301+
assert False
22972302
except TLSLocalAlert as alert:
22982303
if alert.description != AlertDescription.inappropriate_fallback:
22992304
raise
@@ -2356,6 +2361,7 @@ def server_bind(self):
23562361
try:
23572362
connection.handshakeServer(certChain=x509Chain, privateKey=x509Key,
23582363
sessionCache=sessionCache)
2364+
assert False
23592365
except TLSLocalAlert as e:
23602366
assert(str(e) == "illegal_parameter")
23612367
else:

0 commit comments

Comments
 (0)