aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-09-17 17:38:54 -0400
committerRiccardo Spagni <ric@spagni.net>2014-09-23 22:58:28 +0200
commitc14c7e16839b6cfe32527f2b01a9a1507e3d419e (patch)
tree519980c3d1e09f7e29ae6002d30d0126f1b4a8c4 /tests
parentSimplewallet should now resolve urls to addresses (diff)
downloadmonero-c14c7e16839b6cfe32527f2b01a9a1507e3d419e.tar.xz
change to allow (at least a bit) for multiple TXT records
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/address_from_url.cpp13
-rw-r--r--tests/unit_tests/dns_resolver.cpp11
2 files changed, 17 insertions, 7 deletions
diff --git a/tests/unit_tests/address_from_url.cpp b/tests/unit_tests/address_from_url.cpp
index 180257189..22301d568 100644
--- a/tests/unit_tests/address_from_url.cpp
+++ b/tests/unit_tests/address_from_url.cpp
@@ -85,18 +85,23 @@ TEST(AddressFromURL, Success)
std::string addr = "46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em";
bool dnssec_result = false;
- std::string res = tools::wallet2::address_from_url("donate.monero.cc", dnssec_result);
- EXPECT_STREQ(addr.c_str(), res.c_str());
+ std::vector<std::string> addresses = tools::wallet2::addresses_from_url("donate.monero.cc", dnssec_result);
+
+ EXPECT_EQ(1, addresses.size());
+ if (addresses.size() == 1)
+ {
+ EXPECT_STREQ(addr.c_str(), addresses[0].c_str());
+ }
}
TEST(AddressFromURL, Failure)
{
bool dnssec_result = false;
- std::string res = tools::wallet2::address_from_url("example.invalid", dnssec_result);
+ std::vector<std::string> addresses = tools::wallet2::addresses_from_url("example.invalid", dnssec_result);
ASSERT_FALSE(dnssec_result);
- ASSERT_STREQ("", res.c_str());
+ ASSERT_EQ(0, addresses.size());
}
diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp
index 3b52a5f40..27e981ef1 100644
--- a/tests/unit_tests/dns_resolver.cpp
+++ b/tests/unit_tests/dns_resolver.cpp
@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream>
+#include <vector>
#include "gtest/gtest.h"
@@ -97,8 +98,12 @@ TEST(DNSResolver, IPv6Failure)
TEST(DNSResolver, GetTXTRecord)
{
- std::string txt = tools::DNSResolver::instance().get_txt_record("donate.monero.cc");
- std::cout << "TXT record for donate.monero.cc: " << txt << std::endl;
+ std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc");
- EXPECT_STRNE("", txt.c_str());
+ EXPECT_NE(0, records.size());
+
+ for (auto& rec : records)
+ {
+ std::cout << "TXT record for donate.monero.cc: " << rec << std::endl;
+ }
}