diff OrthancFramework/UnitTestsSources/RestApiTests.cpp @ 4325:b96aedfa8cc1

unit tests now running in WebAssembly
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 24 Nov 2020 16:21:29 +0100
parents 318c16cfccab
children 83c5bd439fcc
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp	Tue Nov 24 12:37:52 2020 +0100
+++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp	Tue Nov 24 16:21:29 2020 +0100
@@ -28,15 +28,14 @@
 #include <gtest/gtest.h>
 
 #include "../Sources/ChunkedBuffer.h"
-#include "../Sources/HttpClient.h"
-#include "../Sources/Logging.h"
-#include "../Sources/SystemToolbox.h"
-#include "../Sources/RestApi/RestApi.h"
-#include "../Sources/OrthancException.h"
 #include "../Sources/Compression/ZlibCompressor.h"
-#include "../Sources/RestApi/RestApiHierarchy.h"
 #include "../Sources/HttpServer/HttpContentNegociation.h"
 #include "../Sources/HttpServer/MultipartStreamReader.h"
+#include "../Sources/Logging.h"
+#include "../Sources/OrthancException.h"
+#include "../Sources/RestApi/RestApi.h"
+#include "../Sources/RestApi/RestApiHierarchy.h"
+#include "../Sources/WebServiceParameters.h"
 
 #include <ctype.h>
 #include <boost/lexical_cast.hpp>
@@ -45,7 +44,7 @@
 
 using namespace Orthanc;
 
-#if !defined(UNIT_TESTS_WITH_HTTP_CONNEXIONS)
+#if !defined(UNIT_TESTS_WITH_HTTP_CONNEXIONS) && (ORTHANC_SANDBOXED != 1)
 #  error UNIT_TESTS_WITH_HTTP_CONNEXIONS is not defined
 #endif
 
@@ -53,8 +52,13 @@
 #  error ORTHANC_ENABLE_SSL is not defined
 #endif
 
+#if ORTHANC_SANDBOXED != 1
+#  include "../Sources/HttpClient.h"
+#  include "../Sources/SystemToolbox.h"
+#endif
 
 
+#if ORTHANC_SANDBOXED != 1
 TEST(HttpClient, Basic)
 {
   HttpClient c;
@@ -78,9 +82,10 @@
   ASSERT_TRUE(v.isMember("Description"));
 #endif
 }
+#endif
 
 
-#if UNIT_TESTS_WITH_HTTP_CONNEXIONS == 1 && ORTHANC_ENABLE_SSL == 1
+#if (UNIT_TESTS_WITH_HTTP_CONNEXIONS == 1) && (ORTHANC_ENABLE_SSL == 1) && (ORTHANC_SANDBOXED != 1)
 
 /**
    The HTTPS CA certificates for BitBucket were extracted as follows:
@@ -969,6 +974,8 @@
 
 
 
+#if ORTHANC_SANDBOXED != 1
+
 namespace
 {
   class TotoBody : public HttpClient::IRequestBody
@@ -1059,6 +1066,7 @@
 }
 
 
+
 #include "../Sources/HttpServer/HttpServer.h"
 
 TEST(HttpClient, DISABLED_Issue156_Slow)
@@ -1117,3 +1125,4 @@
 
   server.Stop();
 }
+#endif