Skip to content

Commit

Permalink
Fixed test file order read issus
Browse files Browse the repository at this point in the history
Signed-off-by: AssemblyJohn <[email protected]>
  • Loading branch information
AssemblyJohn committed Oct 23, 2024
1 parent c40569f commit e28a497
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,25 @@ TEST_F(EvseSecurityTestsMulti, verify_multi_root_leaf_retrieval) {
// We have 2 leafs
ASSERT_EQ(result.info.size(), 2);

ASSERT_EQ(fs::path("certs/client/csms/CSMS_LEAF.pem"), result.info[0].certificate_single.value());
ASSERT_EQ(fs::path("certs/client/csms/SECC_LEAF_GRIDSYNC.pem"), result.info[1].certificate_single.value());
fs::path leaf_csms = fs::path("certs/client/csms/CSMS_LEAF.pem");
fs::path leaf_grid = fs::path("certs/client/csms/SECC_LEAF_GRIDSYNC.pem");

// File order is not guaranteed
ASSERT_TRUE(leaf_csms == result.info[0].certificate_single.value() ||
leaf_grid == result.info[0].certificate_single.value());
ASSERT_TRUE(leaf_csms == result.info[1].certificate_single.value() ||
leaf_grid == result.info[1].certificate_single.value());

ASSERT_TRUE(result.info[0].certificate_root.has_value());
ASSERT_TRUE(result.info[1].certificate_root.has_value());

ASSERT_TRUE(equal_certificate_strings(result.info[0].certificate_root.value(),
read_file_to_string("certs/ca/v2g/V2G_ROOT_CA.pem")));
ASSERT_TRUE(equal_certificate_strings(result.info[1].certificate_root.value(),
read_file_to_string("certs/ca/v2g/V2G_ROOT_GRIDSYNC_CA.pem")));
std::string root_v2g = read_file_to_string("certs/ca/v2g/V2G_ROOT_CA.pem");
std::string root_grid = read_file_to_string("certs/ca/v2g/V2G_ROOT_GRIDSYNC_CA.pem");

ASSERT_TRUE(equal_certificate_strings(result.info[0].certificate_root.value(), root_v2g) ||
equal_certificate_strings(result.info[0].certificate_root.value(), root_grid));
ASSERT_TRUE(equal_certificate_strings(result.info[1].certificate_root.value(), root_v2g) ||
equal_certificate_strings(result.info[1].certificate_root.value(), root_grid));
}

TEST_F(EvseSecurityTests, verify_normal_keygen) {
Expand Down

0 comments on commit e28a497

Please sign in to comment.