Skip to content

Commit fc3e4af

Browse files
Xiao Zhuc00kiemon5ter
authored andcommitted
update tests
1 parent c290f1c commit fc3e4af

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

tests/sp_1_conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@
4848
},
4949
],
5050
"secret": "0123456789",
51+
"timeout": 10,
5152
}

tests/test_30_mdstore.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,14 @@ def test_load_extern_incommon(mock_request):
462462

463463
sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
464464
mds = MetadataStore(ATTRCONV, sec_config,
465-
disable_ssl_certificate_validation=True)
465+
disable_ssl_certificate_validation=True,
466+
timeout=10)
466467

467468
mds.imp(METADATACONF["10"])
468469
print(mds)
469470
assert mds
470471
assert len(mds.keys())
472+
mock_request.assert_called_with('GET', 'http://md.incommon.org/InCommon/InCommon-metadata-export.xml', allow_redirects=False, verify=False, timeout=10)
471473

472474

473475
def test_load_local():
@@ -495,10 +497,13 @@ def test_load_remote_encoding(mock_request):
495497

496498
crypto = sigver._get_xmlsec_cryptobackend()
497499
sc = sigver.SecurityContext(crypto, key_type="", cert_type="")
498-
httpc = HTTPBase()
499-
mds = MetaDataExtern(ATTRCONV, 'http://metadata.aai.switch.ch/metadata.aaitest.xml', sc, full_path('SWITCHaaiRootCA.crt.pem'), httpc)
500+
url = 'http://metadata.aai.switch.ch/metadata.aaitest.xml'
501+
httpc = HTTPBase(timeout=10)
502+
mds = MetaDataExtern(ATTRCONV, url, sc, full_path('SWITCHaaiRootCA.crt.pem'), httpc)
500503
mds.load()
501504

505+
mock_request.assert_called_with('GET', url, allow_redirects=False, verify=True, timeout=10)
506+
502507

503508
def test_load_string():
504509
sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])

tests/test_31_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ def test_3():
338338
assert cnf.secret == "0123456789"
339339
assert cnf.metadata is not None
340340
assert cnf.attribute_converters is not None
341+
assert cnf.timeout == 10
341342

342343

343344
def test_sp():

0 commit comments

Comments
 (0)