DRDE/ACTK1_0/OTE/OteLPECreateCommandTest.cpp

87 lines
2.6 KiB
C++
Raw Normal View History

2014-01-15 18:29:15 +00:00
#include "se/ContactCheckCommand.hpp"
#include "se/OteLPECreateCommand.hpp"
#include "se/CLTRID.hpp"
#include "session/Timer.hpp"
#include "common/init.hpp"
#include "common/Test.hpp"
using namespace std;
void doWork()
{
init("/home/drde/etc/toolkit2.conf");
const string registrantName = "AusRegistry";
const string registrantID = "01241326211";
const string registrantIDType = "Trade License";
const string eligibilityType = "Trade License (IT)";
const int policyReason = 1;
const string eligibilityName = "Blah";
const string eligibilityID = "1231239523";
const string eligibilityIDType = "Trademark";
/**
* Test that the XML string generated for a minimal create domain command
* matches the expected XML for an EPP create domain command with those
* parameters.
*/
{
Timer::setTime("20070101.010101");
CLTRID::setClID("JTKUTEST");
vector<string> techIds;
techIds.push_back("JTKCON2");
string registrant("JTKCON");
*ote", "jtkUT3st", &registrant, &techIds,
eligibilityType, policyReason, registrantName);
const string xml(cmd.toXML());
ASSERT_EQ(xml,
*oteProperties></create></extension><clTRID>JTKUTEST.20070101.010101.0</clTRID></command></epp>");
}
/**
* Test that the XML string generated for a sample create domain command
* specified with all available parameters matches the expected XML for
* an EPP create domain command with those parameters.
*
*/
{
Timer::setTime("20070101.010101");
CLTRID::setClID("JTKUTEST");
vector<string> techIds;
techIds.push_back("JTKCON2");
vector<string> adminContacts;
adminContacts.push_back("JTKCON");
adminContacts.push_back("JTKCON2");
string registrant("JTKCON");
vector<string> nameServers;
nameServers.push_back("ns1.ausregistry.net");
nameServers.push_back("ns2.ausregistry.net");
Period period(48, PeriodUnit::MONTHS());
OteLPECreateCommand cmd(
*ote", "jtkUT3st", &registrant,
&techIds, &adminContacts,
NULL, &nameServers, &period,
eligibilityType, policyReason,
registrantName, &registrantID,
&registrantIDType, &eligibilityName,
&eligibilityID, &eligibilityIDType);
const string xml(cmd.toXML());
*oteProperties></create></extension><clTRID>JTKUTEST.20070101.010101.0</clTRID></command></epp>");
}
}
int main(int argc, char* argv[])
{
TEST_run(doWork);
return TEST_errorCount();
}