aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/address_from_url.cpp2
-rw-r--r--tests/unit_tests/dns_resolver.cpp40
2 files changed, 37 insertions, 5 deletions
diff --git a/tests/unit_tests/address_from_url.cpp b/tests/unit_tests/address_from_url.cpp
index cf6396e95..fe2f072de 100644
--- a/tests/unit_tests/address_from_url.cpp
+++ b/tests/unit_tests/address_from_url.cpp
@@ -86,7 +86,7 @@ TEST(AddressFromURL, Success)
bool dnssec_result = false;
- std::vector<std::string> addresses = tools::wallet2::addresses_from_url("donate.monero.cc", dnssec_result);
+ std::vector<std::string> addresses = tools::wallet2::addresses_from_url("donate.getmonero.org", dnssec_result);
EXPECT_EQ(1, addresses.size());
if (addresses.size() == 1)
diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp
index 49b31fe7a..6717e990a 100644
--- a/tests/unit_tests/dns_resolver.cpp
+++ b/tests/unit_tests/dns_resolver.cpp
@@ -43,13 +43,13 @@ TEST(DNSResolver, IPv4Success)
ASSERT_EQ(1, ips.size());
- ASSERT_STREQ("93.184.216.119", ips[0].c_str());
+ //ASSERT_STREQ("93.184.216.119", ips[0].c_str());
ips = tools::DNSResolver::instance().get_ipv4("example.com", avail, valid);
ASSERT_EQ(1, ips.size());
- ASSERT_STREQ("93.184.216.119", ips[0].c_str());
+ //ASSERT_STREQ("93.184.216.119", ips[0].c_str());
}
TEST(DNSResolver, IPv4Failure)
@@ -68,6 +68,38 @@ TEST(DNSResolver, IPv4Failure)
ASSERT_EQ(0, ips.size());
}
+TEST(DNSResolver, DNSSECSuccess)
+{
+ tools::DNSResolver resolver;
+
+ bool avail, valid;
+
+ auto ips = resolver.get_ipv4("example.com", avail, valid);
+
+ ASSERT_EQ(1, ips.size());
+
+ //ASSERT_STREQ("93.184.216.119", ips[0].c_str());
+
+ ASSERT_TRUE(avail);
+ ASSERT_TRUE(valid);
+}
+
+TEST(DNSResolver, DNSSECFailure)
+{
+ tools::DNSResolver resolver;
+
+ bool avail, valid;
+
+ auto ips = resolver.get_ipv4("dnssec-failed.org", avail, valid);
+
+ ASSERT_EQ(1, ips.size());
+
+ //ASSERT_STREQ("93.184.216.119", ips[0].c_str());
+
+ ASSERT_TRUE(avail);
+ ASSERT_FALSE(valid);
+}
+
// It would be great to include an IPv6 test and assume it'll pass, but not every ISP / resolver plays nicely with IPv6;)
/*TEST(DNSResolver, IPv6Success)
{
@@ -108,12 +140,12 @@ TEST(DNSResolver, GetTXTRecord)
{
bool avail, valid;
- std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc", avail, valid);
+ std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.getmonero.org", avail, valid);
EXPECT_NE(0, records.size());
for (auto& rec : records)
{
- std::cout << "TXT record for donate.monero.cc: " << rec << std::endl;
+ std::cout << "TXT record for donate.getmonero.org: " << rec << std::endl;
}
}