mirror of
https://github.com/NixOS/nix
synced 2025-06-30 19:57:59 +02:00
_not_ round-trip tests for fetchers::PublicKey
default type
(#10637)
Another continuation of #10602
This commit is contained in:
parent
ee2fa87a7e
commit
feb1d10f60
2 changed files with 12 additions and 0 deletions
3
tests/unit/libfetchers/data/public-key/noRoundTrip.json
Normal file
3
tests/unit/libfetchers/data/public-key/noRoundTrip.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"key": "ABCDE"
|
||||||
|
}
|
|
@ -42,4 +42,13 @@ TEST_JSON(PublicKeyTest, simple, (fetchers::PublicKey { .type = "ssh-rsa", .key
|
||||||
TEST_JSON(PublicKeyTest, defaultType, fetchers::PublicKey { .key = "ABCDE" })
|
TEST_JSON(PublicKeyTest, defaultType, fetchers::PublicKey { .key = "ABCDE" })
|
||||||
|
|
||||||
#undef TEST_JSON
|
#undef TEST_JSON
|
||||||
|
|
||||||
|
TEST_F(PublicKeyTest, PublicKey_noRoundTrip_from_json) {
|
||||||
|
readTest("noRoundTrip.json", [&](const auto & encoded_) {
|
||||||
|
fetchers::PublicKey expected = { .type = "ssh-ed25519", .key = "ABCDE" };
|
||||||
|
fetchers::PublicKey got = nlohmann::json::parse(encoded_);
|
||||||
|
ASSERT_EQ(got, nlohmann::json(expected));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue