EmailChallenge: add requester's certificate name into the email content
Change-Id: I3231640daf0daa9edbac1fea694fbbbdcdb353fa
diff --git a/tests/unit-tests/challenge-email.t.cpp b/tests/unit-tests/challenge-email.t.cpp
index 3b9850c..af86a5f 100644
--- a/tests/unit-tests/challenge-email.t.cpp
+++ b/tests/unit-tests/challenge-email.t.cpp
@@ -64,17 +64,28 @@
std::string line = "";
std::string delimiter = " ";
std::ifstream emailFile("tmp.txt");
- if (emailFile.is_open())
- {
+ if (emailFile.is_open()) {
getline(emailFile, line);
emailFile.close();
}
- std::string recipientEmail = line.substr(0, line.find(delimiter));
- std::string secret = line.substr(line.find(delimiter) + 1);
-
+ int end = line.find(delimiter);
+ std::string recipientEmail = line.substr(0, end);
BOOST_CHECK_EQUAL(recipientEmail, "zhiyi@cs.ucla.edu");
+ line = line.substr(end + 1);
+
+ end = line.find(delimiter);
+ std::string secret = line.substr(0, end);
auto stored_secret = request.m_challengeSecrets.get<std::string>(ChallengeEmail::JSON_CODE);
BOOST_CHECK_EQUAL(secret, stored_secret);
+ line = line.substr(end + 1);
+
+ end = line.find(delimiter);
+ std::string caName = line.substr(0, end);
+ BOOST_CHECK_EQUAL(caName, Name("/ndn/site1"));
+ line = line.substr(end + 1);
+
+ std::string certName = line;
+ BOOST_CHECK_EQUAL(certName, cert.getName().toUri());
std::remove("tmp.txt");
}
diff --git a/tests/unit-tests/test-send-email.sh b/tests/unit-tests/test-send-email.sh
index 901d057..077908b 100755
--- a/tests/unit-tests/test-send-email.sh
+++ b/tests/unit-tests/test-send-email.sh
@@ -2,7 +2,10 @@
RECEIVER=$1
SECRET=$2
+CANAME=$3
+CERTNAME=$4
-MESSAGE=$RECEIVER" "$SECRET
+MESSAGE=$RECEIVER" "$SECRET" "$CANAME" "$CERTNAME
echo $MESSAGE > tmp.txt
+echo $MESSAGE