Skip to content

Commit

Permalink
test(fixtures): move certificate fixtures to source code (#3554)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jan 18, 2025
1 parent 89f097a commit 26566cc
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 53 deletions.
4 changes: 0 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS
set(SUNSHINE_SOURCES
${SUNSHINE_TARGET_FILES})

# copy fixtures to build directory
file(COPY ${CMAKE_SOURCE_DIR}/tests/fixtures/unit
DESTINATION ${CMAKE_BINARY_DIR}/tests/fixtures)

# remove main.cpp from the list of sources
list(REMOVE_ITEM SUNSHINE_SOURCES ${CMAKE_SOURCE_DIR}/src/main.cpp)

Expand Down
28 changes: 0 additions & 28 deletions tests/fixtures/unit/pairing_test_key.pem

This file was deleted.

18 changes: 0 additions & 18 deletions tests/fixtures/unit/pairing_test_public.cert

This file was deleted.

49 changes: 46 additions & 3 deletions tests/unit/test_http_pairing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <src/nvhttp.h>

#include "../tests_common.h"
#include "src/file_handler.h"

using namespace nvhttp;

Expand All @@ -30,8 +29,52 @@ struct pairing_output {
bool phase_4_success;
};

const auto PRIVATE_KEY = file_handler::read_file("fixtures/unit/pairing_test_key.pem");
const auto PUBLIC_CERT = file_handler::read_file("fixtures/unit/pairing_test_public.cert");
const std::string PRIVATE_KEY = R"(-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDLePNlWN06FLlM
ujWzIX8UICO7SWfH5DXlafVjpxwi/WCkdO6FxixqRNGu71wMvJXFbDlNR8fqX2xo
+eq17J3uFKn+qdjmP3L38bkqxhoJ/nCrXkeGyCTQ+Daug63ZYSJeW2Mmf+LAR5/i
/fWYfXpSlbcf5XJQPEWvENpLqWu+N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Djl89pZMll3Ge8RS7HeDuzgocrhOcT2jnk4ag7
/TROZuISjDp6+SnL3gPEt7E2OcFAczTg3l/wbT5PFb6vM96saLm4EP0zmLfK1FnM
JDRahKutP9rx6RO5OHqsUB+b4jA4W0L9UnXUoLKbjig501AUix0p52FBxu+HJ90r
HlLs3Vo6nj4Z/PZXrzaz8dtQ/KJMpd/g/9xlo6BKAnRk5SI8KLhO4hW6zG0QA56j
X4wnh1bwdiidqpcgyuKossLOPxbS786WmsesaAWPnpoY6M8aija+ALwNNuWWmyMg
9SVDV76xJzM36Uq7Kg3QJYTlY04WmPIdJHkCtXWf9g==
-----END CERTIFICATE-----)";

struct PairingTest: testing::TestWithParam<std::tuple<pairing_input, pairing_output>> {};

Expand Down

0 comments on commit 26566cc

Please sign in to comment.