comparison OrthancFramework/UnitTestsSources/RestApiTests.cpp @ 5000:e56a6beb454e

fix unit tests HttpClient.Ssl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 May 2022 10:55:34 +0200
parents e9f9711667e1
children 0ea402b4d901
comparison
equal deleted inserted replaced
4999:f67b8bb90ab6 5000:e56a6beb454e
108 108
109 (3) Once we get the URL to the CA certificate, we convert it to a C 109 (3) Once we get the URL to the CA certificate, we convert it to a C
110 macro that can be used by libcurl: 110 macro that can be used by libcurl:
111 111
112 # cd UnitTestsSources 112 # cd UnitTestsSources
113 # ../Resources/RetrieveCACertificates.py BITBUCKET_CERTIFICATES https://cacerts.digicert.com/DigiCertSHA2HighAssuranceServerCA.crt > BitbucketCACertificates.h 113 # ../Resources/RetrieveCACertificates.py BITBUCKET_CERTIFICATES https://cacerts.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crt > BitbucketCACertificates.h
114 **/ 114 **/
115 115
116 #include "BitbucketCACertificates.h" 116 #include "BitbucketCACertificates.h"
117 117
118 TEST(HttpClient, Ssl) 118 TEST(HttpClient, Ssl)
119 { 119 {
120 SystemToolbox::WriteFile(BITBUCKET_CERTIFICATES, "UnitTestsResults/bitbucket.cert"); 120 SystemToolbox::WriteFile(BITBUCKET_CERTIFICATES, "UnitTestsResults/bitbucket.cert");
121 121
122 /*{ 122 /*{
123 std::string s; 123 std::string s;
124 SystemToolbox::ReadFile(s, "/usr/share/ca-certificates/mozilla/WoSign.crt"); 124 SystemToolbox::ReadFile(s, "/etc/ssl/certs/ca-certificates.crt");
125 SystemToolbox::WriteFile(s, "UnitTestsResults/bitbucket.cert"); 125 SystemToolbox::WriteFile(s, "UnitTestsResults/bitbucket.cert");
126 }*/ 126 }*/
127 127
128 HttpClient c; 128 HttpClient c;
129 //c.SetVerbose(true);
129 c.SetHttpsVerifyPeers(true); 130 c.SetHttpsVerifyPeers(true);
130 c.SetHttpsCACertificates("UnitTestsResults/bitbucket.cert"); 131 c.SetHttpsCACertificates("UnitTestsResults/bitbucket.cert");
131 132
132 // Test file modified on 2020-04-20, in order to use a git 133 // Test file modified on 2020-04-20, in order to use a git
133 // repository on BitBucket instead of a Mercurial repository 134 // repository on BitBucket instead of a Mercurial repository