Skip to content
Permalink
Browse files

[auth] Add test with client cert

  • Loading branch information
elpaso committed Oct 26, 2017
1 parent e036fc8 commit 287d1f751fce6385c0a1f613b72f082b238149cd
Showing with 6 additions and 4 deletions.
  1. +6 −4 tests/src/python/test_qgsauthsystem.py
@@ -626,10 +626,10 @@ def testChain(path):
# Test that a chain with an untrusted CA is not valid
self.assertTrue(len(QgsAuthCertUtils.validateCertChain(QgsAuthCertUtils.certsFromFile(path))) > 0)

# Test that a chain with an untrusted CA is valid when the addRootCa argumentis true
# Test that a chain with an untrusted CA is valid when the addRootCa argument is true
self.assertTrue(len(QgsAuthCertUtils.validateCertChain(QgsAuthCertUtils.certsFromFile(path), None, True)) == 0)

# Test that a chain with an untrusted CA is not valid when the addRootCa argumentis true
# Test that a chain with an untrusted CA is not valid when the addRootCa argument is true
# and a wrong domainis true
self.assertTrue(len(QgsAuthCertUtils.validateCertChain(QgsAuthCertUtils.certsFromFile(path), 'my.wrong.domain', True)) > 0)

@@ -638,18 +638,20 @@ def testChain(path):

path = PKIDATA + '/localhost_ssl_w-chain.pem'

# Test that a chain with an untrusted CA is not valid when the addRootCa argumentis true
# Test that a chain with an untrusted CA is not valid when the addRootCa argument is true
# and a wrong domain is set
self.assertTrue(len(QgsAuthCertUtils.validateCertChain(QgsAuthCertUtils.certsFromFile(path), 'my.wrong.domain', True)) > 0)

# Test that a chain with an untrusted CA is valid when the addRootCa argumentis true
# Test that a chain with an untrusted CA is valid when the addRootCa argument is true
# and a right domain is set
self.assertTrue(len(QgsAuthCertUtils.validateCertChain(QgsAuthCertUtils.certsFromFile(path), 'localhost', True)) == 0)

# Test that a chain with an untrusted CA is not valid when the addRootCa argument is false
# and a right domain is set
self.assertTrue(len(QgsAuthCertUtils.validateCertChain(QgsAuthCertUtils.certsFromFile(path), 'localhost', False)) > 0)

testChain(PKIDATA + '/fra_w-chain.pem')


if __name__ == '__main__':
unittest.main()

0 comments on commit 287d1f7

Please sign in to comment.
You can’t perform that action at this time.