Added test for libcurl https handling disabled on build server.

Linux docker image does not expose port 80
This commit is contained in:
tamasmeszaros 2020-03-06 15:18:14 +01:00
parent b6aeffb618
commit f4f236e82e
5 changed files with 38 additions and 17 deletions

View File

@ -29,7 +29,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_subdirectory(libnest2d) add_subdirectory(libnest2d)
add_subdirectory(libslic3r) add_subdirectory(libslic3r)
add_subdirectory(timeutils) add_subdirectory(slic3rutils)
add_subdirectory(fff_print) add_subdirectory(fff_print)
add_subdirectory(sla_print) add_subdirectory(sla_print)
add_subdirectory(cpp17 EXCLUDE_FROM_ALL) # does not have to be built all the time add_subdirectory(cpp17 EXCLUDE_FROM_ALL) # does not have to be built all the time

View File

@ -13,6 +13,7 @@ add_executable(${_TEST_NAME}_tests
test_stl.cpp test_stl.cpp
test_meshsimplify.cpp test_meshsimplify.cpp
test_meshboolean.cpp test_meshboolean.cpp
test_timeutils.cpp
) )
if (TARGET OpenVDB::openvdb) if (TARGET OpenVDB::openvdb)

View File

@ -1,4 +1,4 @@
#include <catch_main.hpp> #include <catch2/catch.hpp>
#include "libslic3r/Time.hpp" #include "libslic3r/Time.hpp"
@ -6,9 +6,9 @@
#include <iomanip> #include <iomanip>
#include <locale> #include <locale>
namespace { using namespace Slic3r;
void test_time_fmt(Slic3r::Utils::TimeFormat fmt) { static void test_time_fmt(Slic3r::Utils::TimeFormat fmt) {
using namespace Slic3r::Utils; using namespace Slic3r::Utils;
time_t t = get_current_time_utc(); time_t t = get_current_time_utc();
@ -26,7 +26,6 @@ void test_time_fmt(Slic3r::Utils::TimeFormat fmt) {
parsedtime = str2time("not valid string", TimeZone::utc, fmt); parsedtime = str2time("not valid string", TimeZone::utc, fmt);
REQUIRE(parsedtime == time_t(-1)); REQUIRE(parsedtime == time_t(-1));
} }
}
TEST_CASE("ISO8601Z", "[Timeutils]") { TEST_CASE("ISO8601Z", "[Timeutils]") {
test_time_fmt(Slic3r::Utils::TimeFormat::iso8601Z); test_time_fmt(Slic3r::Utils::TimeFormat::iso8601Z);

View File

@ -1,11 +1,10 @@
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
add_executable(${_TEST_NAME}_tests add_executable(${_TEST_NAME}_tests
${_TEST_NAME}_tests_main.cpp ${_TEST_NAME}_tests_main.cpp
${PROJECT_SOURCE_DIR}/src/libslic3r/Time.cpp
${PROJECT_SOURCE_DIR}/src/libslic3r/Time.hpp
) )
target_link_libraries(${_TEST_NAME}_tests test_common)
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r_gui)
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ") # catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS}) add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "${CATCH_EXTRA_ARGS} exclude:[NotWorking]")

View File

@ -0,0 +1,22 @@
#include <catch_main.hpp>
#include "slic3r/Utils/Http.hpp"
TEST_CASE("Http", "[Http][NotWorking]") {
Slic3r::Http g = Slic3r::Http::get("https://github.com/");
unsigned status = 0;
g.on_error([&status](std::string, std::string, unsigned http_status) {
status = http_status;
});
g.on_complete([&status](std::string /* body */, unsigned http_status){
status = http_status;
});
g.perform_sync();
REQUIRE(status == 200);
}