slic3rutils_tests_main.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <catch_main.hpp>
  2. #include "slic3r/Utils/Http.hpp"
  3. TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
  4. Slic3r::Http g = Slic3r::Http::get("https://github.com/");
  5. unsigned status = 0;
  6. g.on_error([&status](std::string, std::string, unsigned http_status) {
  7. status = http_status;
  8. });
  9. g.on_complete([&status](std::string /* body */, unsigned http_status){
  10. status = http_status;
  11. });
  12. g.perform_sync();
  13. REQUIRE(status == 200);
  14. }
  15. TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
  16. Slic3r::Http g = Slic3r::Http::get("https://jigsaw.w3.org/HTTP/Digest/");
  17. g.auth_digest("guest", "guest");
  18. unsigned status = 0;
  19. g.on_error([&status](std::string, std::string, unsigned http_status) {
  20. status = http_status;
  21. });
  22. g.on_complete([&status](std::string /* body */, unsigned http_status){
  23. status = http_status;
  24. });
  25. g.perform_sync();
  26. REQUIRE(status == 200);
  27. }
  28. TEST_CASE("Http basic authentication", "[Http][NotWorking]") {
  29. Slic3r::Http g = Slic3r::Http::get("https://jigsaw.w3.org/HTTP/Basic/");
  30. g.auth_basic("guest", "guest");
  31. unsigned status = 0;
  32. g.on_error([&status](std::string, std::string, unsigned http_status) {
  33. status = http_status;
  34. });
  35. g.on_complete([&status](std::string /* body */, unsigned http_status){
  36. status = http_status;
  37. });
  38. g.perform_sync();
  39. REQUIRE(status == 200);
  40. }