diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-06-24 09:21:37 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-06-24 09:21:37 +0200 |
commit | 3d39f109ba8ea7ae9778c58bd1665b9e8e0f45cb (patch) | |
tree | 9a5684babcd16d302fbe59c56b6045660ad62488 /tests/network.cpp | |
parent | f9cee98aacd6aea8ccb7f5677b4ff1e1e234e4d1 (diff) | |
parent | c21cbbf9667991d2b928562a9c199e625d3f9bba (diff) | |
download | biboumi-3d39f109ba8ea7ae9778c58bd1665b9e8e0f45cb.tar.gz biboumi-3d39f109ba8ea7ae9778c58bd1665b9e8e0f45cb.tar.bz2 biboumi-3d39f109ba8ea7ae9778c58bd1665b9e8e0f45cb.tar.xz biboumi-3d39f109ba8ea7ae9778c58bd1665b9e8e0f45cb.zip |
Updated version 5.0 from 'upstream/5.0'
with Debian dir 2ae31d03ffb1d79153a692af23c7b2b097cc4b2b
Diffstat (limited to 'tests/network.cpp')
-rw-r--r-- | tests/network.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/network.cpp b/tests/network.cpp new file mode 100644 index 0000000..33cf023 --- /dev/null +++ b/tests/network.cpp @@ -0,0 +1,44 @@ +#include "catch.hpp" +#include <network/tls_policy.hpp> + +#ifdef BOTAN_FOUND +TEST_CASE("tls_policy") +{ + BiboumiTLSPolicy policy; + const auto default_minimum_signature_strength = policy.minimum_signature_strength(); + const auto default_session_ticket_lifetime = policy.session_ticket_lifetime(); + const auto default_minimum_rsa_bits = policy.minimum_rsa_bits(); + + policy.load("does not exist"); + WHEN("we fail to load the file") + { + THEN("all values are the default ones") + { + CHECK(policy.minimum_signature_strength() == default_minimum_signature_strength); + CHECK(policy.minimum_rsa_bits() == default_minimum_rsa_bits); + } + AND_WHEN("we load a valid first file") + { + std::istringstream iss("minimum_signature_strength = 128\nminimum_rsa_bits=12\n"); + policy.load(iss); + THEN("the specified values are updated, and the rest is still the default") + { + CHECK(policy.minimum_signature_strength() == 128); + CHECK(policy.minimum_rsa_bits() == 12); + CHECK(policy.session_ticket_lifetime() == default_session_ticket_lifetime); + } + AND_WHEN("we load a second file") + { + std::istringstream iss("minimum_signature_strength = 15"); + policy.load(iss); + THEN("the specified values are updated, and the rest is untouched") + { + CHECK(policy.minimum_signature_strength() == 15); + CHECK(policy.minimum_rsa_bits() == 12); + CHECK(policy.session_ticket_lifetime() == default_session_ticket_lifetime); + } + } + } + } +} +#endif |