Skip to content

Commit

Permalink
[auth] Add test with client cert
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 26, 2017
1 parent e036fc8 commit 287d1f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/src/python/test_qgsauthsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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.